using a regular expression in PHP with preg_replace_callback how can I check if two parts of the pattern are the same?
preg_replace_callback('/Blah: (.*?), BLah Blah (.+?), (**Strin开发者_Go百科g Here Must Be Same as First Match**)/s', create_function(), $subject);
Thanks, Matt
You can use a backreference:
/Blah: (.*?), BLah Blah (.+?), \1/s
\1
here denotes the first matched group.
精彩评论