Re: Regular Expressions?
| From: | Morgan Curley | Date: | Fri, 20 Apr 2001 14:09:01 +0000 |
| Subject: | Re: Regular Expressions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49564@lists.php.net to get a copy of this message | ||
I don't use ereg(i)? much myself but for a perl compat regex I would:
/^(([0-9a-z](\2*))\.([0-9a-z](\2*)))/i
the \# refer to parenthized matches starting at 1 and counting left parens. The match array index you will want is $myArray[1].
if you don't mind matching
1a2.1a2 you can use
/^(([0-9a-z]+)\.\1+)/i
or
123.456
/^([0-9a-z]+\.[0-9a-z]+)/i
morgan
""Jason Caldwell"" <jason@thinkingman.org> wrote in message news:9boi65$ipb$1@toye.p.sourceforge.net... I'm looking to compare if my array values match any digits or alpha characters with a dot between them... so, if I think I understand Regular Expressions (from what I could gather from PHP.net and Core PHP Programming by Leon Atkinson.) I want to match any of the following: 1.1 or a.aor 1111.1111 or aaaa.aaaa <-- any number of digits (0-9) or alpha (a-z)on either side of the dot. if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x])) Is this correct? I think I'm missing something. Thanks. Jason