janharders

msg:3985917 | 10:17 am on Sep 8, 2009 (gmt 0) |
Just use [url=www.php.net/preg_match]preg_match[/url] to check for ^p\d+$ or ^p(\d+)$ if you want to work on the numeric part.
|
ahmed24

msg:3985924 | 10:47 am on Sep 8, 2009 (gmt 0) |
i've managed to do this: if (!preg_match('/[[:^digit:]]/', $username)) { } but this only detects if it is a number, how can i determine if it also begins with a letter p ?
|
janharders

msg:3985932 | 12:00 pm on Sep 8, 2009 (gmt 0) |
As I said, use ^p\d+$ as the regexp (that's [[:^digit:]] in your example) to check for that. the ^ matches at the beginning of the string, and $ at the end, so that'll let p123 through, but not p123a or ap123.
|
ahmed24

msg:3985951 | 1:06 pm on Sep 8, 2009 (gmt 0) |
thats great, works perfectly now. thanks
|
|