I have a string with a number of ‘shortcodes’ in thus (just using an example):
$str = "http://www.aaa...\n
http://www.bbb...";
I’m trying to match each one independantly using preg_match() thus:
pregmatch( '/\/', $str, $matches );
Now I expect count($matches); to return ‘2’. But I only get 1 each time. Is my regular expression wrong? I need to assaign each to a new array item so I can deal with them individually.
Thanks
You need to use
preg_match_all:See it