| Perl-Compatible Regular Expressions (PCRE) |
| Article Index |
|---|
| Perl-Compatible Regular Expressions (PCRE) |
| Page 2 |
| Page 3 |
| Page 4 |
| Page 5 |
| Page 6 |
| Page 7 |
| Page 8 |
| Page 9 |
| Page 10 |
Page 2 of 10
As you can see, PCRE are significantly more concise than their POSIX counterparts. In fact, our simple email validation regex can now be written as
/\w+@\w+\.\w{2,4}/
But, wait a minutewhat are those slash characters at the beginning and at the end of the regex string? PCRE requires that the actual regular expression be delimited by two characters. By convention, two forward slashes are used, although any character other than the backslash that is not alphanumeric would do just as well.
Naturally, regardless of which character you choose, you will be required to escape the delimiter whenever you use it as part of the regex itself. For example:
This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a comment.
Tags: Simple PHP, Pear, Easy PHP, PHP Tutorial, PHP MySQL, XSLT, Sap Tutorial, CSS Tutorial, XSL FO Java, SQL Tutorial.
| Users' Comments (0) |
|
No comment posted








