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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to