Gossamer Forum
Home : General : Perl Programming :

Stupid Regex Question...

Quote Reply
Stupid Regex Question...
Ok, i never said I was good with regex, but theoretically this SHOULD work, but it doesn't...lol.

Code:
if(!preg_match("/[a-zA-Z]{2,15}+\s{1,2}+[a-zA-Z]{2,25}+$/", $name))
{
error("The name you provided not appear to be valied. Please note it needs to be your FULL name. Please try again...");
}

The error code returned is;

Quote:
Warning: Compilation failed: nothing to repeat at offset 14 in c:\program files\nusphere\apache\nsdocs\test\wedding\add.php on line 212

Anyone got an idea on why this is? I'm trying to search for 2-15 characters for the first name, then no more than 2 spaces, and then 2-25 charahters for the last name. For some reason it doesn't like the formatting (if I remove the {...} parts it works ok).

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Stupid Regex Question... Andy 6754 Mar 9, 2002, 6:15 AM
Thread Re: [AndyNewby] Stupid Regex Question...
Paul 6435 Mar 9, 2002, 6:24 AM
Thread Re: [RedRum] Stupid Regex Question...
Andy 6440 Mar 9, 2002, 6:26 AM
Thread Re: [AndyNewby] Stupid Regex Question...
Paul 6459 Mar 9, 2002, 6:27 AM
Thread Re: [RedRum] Stupid Regex Question...
Andy 6461 Mar 9, 2002, 7:23 AM
Thread Re: [AndyNewby] Stupid Regex Question...
Paul 6462 Mar 9, 2002, 7:24 AM
Post Re: [RedRum] Stupid Regex Question...
Andy 6442 Mar 9, 2002, 7:29 AM
Post Re: [RedRum] Stupid Regex Question...
Andy 6422 Mar 9, 2002, 6:28 AM