Pages

9/23/2004

Regular Expressions


I want to create a regex that finds everything before the first period in a string. (Like match the www in the string "www.google.com") The problem is that
^.*\.
won't stop at first occurrance it will match www.google.
To do this the regex is:
^[^.]*\.

That means to match 0 to any number of a character that is NOT a period

No comments: