Regular Expression (preg_match_all)
- by Helena
This is my code:
<?php
$matchWith = "http://videosite.com/ID123";
preg_match_all('\S/videosite\.com\/(\w+)\S/i', $matchWith, $matches);
foreach($matches[1] as $value)
{
print '<a href="http://videosite.com/'.$value.'">
Hyperlink
</a>';
}
?>
It's not working.
I want to exclude every match that has a whitespace before or after the Link (with the ID).
I used \S for this.
For example if:
$matchWith = " http://videosite.com/ID123 ";
it should not display anything.
Thank you.