Page 1 of 1

ereg() Regex Problem...

Posted: Sat Jul 27, 2002 2:04 am
by Kalar
I could have sworn this worked before, but now this code is giving me a problem.

Code: Select all

$temp_name = 'john';
if(!ereg('^їA-Za-zÀ-ÖØ-öø-ÿї:digit:]_]{1,20}', $temp_name)) {
	echo 'regex does not match.';
} else {
	echo 'regex does match.';
}
The error it produces is:

Code: Select all

Warning: Invalid range end in test.php on line 2
regex does not match.
I'm assuming that it means there's a problem with the '{1,20}', but isn't that valid? There's no spaces in there at all, just one character after another.

Any ideas?

Currently running PHP v.4.0.3 [trust me, it's not my choice, my ISP pretty much decides this stuff for me =[.

Any help would be appreciated. Thanks in advance.

[Edit: corrected the error line number, since it didn't match the c'n'p code above.]

Posted: Sat Jul 27, 2002 1:14 pm
by Kalar
Well, I fixed it, but not the way I wanted.

I changed the ereg() pattern to this:

Code: Select all

ereg('^їA-Za-zї:digit:]_]{1,20}', $temp_name)
Apparently the script doesn't seem to like the "odd" ASCII, even though I know other people have used it before.

I can't help but wonder now if anyone has a solution to this, or at least knows why it happens...