Here is an example:
return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?
(/.*)?$|i', $url);
Here is another:
preg_match_all("|<[^>]+>(.*)</[^>]+>|U", "<b>example: </b><div align=left>this is a test</div>", $out, PREG_PATTERN_ORDER);
Isn’t | a OR in Regex? What does it mean when a regex starts with a | ?
He’s using it as the regex delimiter which is an extremely bad idea as it prevents it from being used as the OR operator.
While it does make sense not to use
/when dealing with URLs or anything else where slashes are often used (as every normal/would have to be escaped as\/in that case) it’s usually much better to use e.g.#or~as the delimiter since those are normal characters in the regex itself.