Re: Regular Expressions?

From: Date: Fri, 20 Apr 2001 06:19:48 +0000
Subject: Re: Regular Expressions?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-49498@lists.php.net to get a copy of this message
Thanks Brian! Very helpful. Is there a good website that covers Regular Expressions? Jason "Brian Clark" <brianj@fusionwerks.com> wrote in message news:92203389127.20010420015151@fusionwerks.com... > Hi Jason, > > @ 1:43:19 AM on 4/20/2001, Jason Caldwell wrote: > > ... > > I want to match any of the following: > > > 1.1 or a.a > > > or 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])) > > Your parentheses are slightly wrong. > > if( > eregi( > "^ > ( > /* unmatched parens */ > > [0-9][a-z] > /* only matches one digit or character */ > > \. > /* matches period */ > > [0-9][a-z] > /* only matches one digit or character */ > ", > $myArray[x] > ) > /* syntax error :) */ > ) > > > Is this correct? I think I'm missing something. > > You want something like this: > > <?php > > /* eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $myArray[x]) */ > > $string = 'aaa.aaa'; > $string_2 = 'aaaaaa'; > > print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : > 'no match'); > print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string_2) ? 'matched' : > 'no match'); > > ?> > > > Thanks. > > Jason > > -Brian > -- > PGP is spoken here: 0xE4D0C7C8 > Please, DO NOT carbon copy me on list replies. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#49498) next »