I am trying to create a regular expression that can parse both variables ($src and $src1) and get the result of Prop, Nam and Tra. (Ignoring any information after).
<?php
$src = "{{Data#Prop=11a|Nam=33a|Tra=46b}}";
$src1 = "{{Data#Prop=11a|Nam=33a|Tra=46b|extra=384v}}";
preg_match_all('/\{\{Data#Prop\=([a-z 0-9]*)\|Nam\=([a-z 0-9]*)\|Tra=([a-z 0-9]*)????\}\}/Umis', $src, $st);
?>
For both $src and $src1 the script should return $st[0] = 11a; $st[1] = "33a"; $st[2] = "46b;
I need to put a expression where the question marks are '????' that optionally looks for '\|(.*)'
If I include '\|(.*)' $src1 works but $src doesn't work, if I remove '\|(.*)' $src works but $src1 doesn't work.