Hello on a tut i c the below code
/*** get the host name from a url ***/
preg_match('#^(?:http://)?([^/]+)#i', "http://www.phpro.org/tutorials", $matches);
/*** show the host name ***/
What's the meaning of
That defines a non capturing group, for example in your result for $matches http:// will never show up because it's been told to match but not be returned.
Thank you. I appreciate it
Fuller details can be found in the PHP manual at http://php.net/regexp.reference.subpatterns
Just to break up your regular expression further:
DelimiterPattern ModifierQuantifierSub-patternCharacter ClassPlace Holder (Meta Character)AssertionString to matchAnything but the following
This topic is now closed. New replies are no longer allowed.