Forum Moderators: coopster
Thanx,
If any problem ask them!
Patrick
echo strlen("blah"); Prints 4
Pattern matching is accomplished through regular expressions. RegExp can be quite complicated. (preg_replace documentation [php.net])
For example, if you want to match only letters and numbers, you can do something like this:
if(preg_match("/[A-Za-z0-9]/",$string)) {
echo "The string '$string' contains only letters and numbers";
}
If you want to match anything but letters and numbers you do this:
if(preg_match("/[^A-Za-z0-9]/",$string)) {
echo "The string contains some other character than letter and number";
}
PHP Pattern Syntax [php.net]
Perl Regular Expressions [perldoc.com] - good start for regexp newbies