Quote:
Originally Posted by SkyCatcher
I'm a total preg_match noob. Everytime I look at those it makes my head hurt.
What exactly is it looking for here. I don't see what the criteria are.
PHP Code:
$re = "/(www\.)?(\w*[^\.])(\.[a-z]{2,3})/";
From what I can guess it's searching for "www", and then any combination of 2 letters after a " . " ?
|
Sorry I did not know there was a question for me here.
regexp is hard to use at once but easy to implement if you know what you want to reach.
especially if know what conditions / quantifiers must be used.
For that regexp, I gave an example of what that regexp would match, mainly:
domain.com OR
domain.co
Code:
$re = "/(www\.)?(\w*[^\.])(\.[a-z]{2,3})/";
(www\.)? means we could have www or not.
consider this list of urls
domain.com
www.
domain.com
http://www.
domain.com/vb/images/page.php
http://www.
domain.co.uk/vb/image/pages/page.php
as you see, not interested in the full URL.
check this, might help a lot:
http://www.ilovejackdaniels.com/regu...heat_sheet.png
and must know if there is a match, how many found, and how to iterate through the result array.
sorry for the late reply, better later than never though