PHP Regular Expressions and Pattern Matching

such as Perl, PHP offers a wide range of regular expression metacharacters to determine how a model such as the regular expression … .

More PDF Content

PHP Regular Expressions and Pattern Matching
/^[a-zA-Z][\\\\w \\\\.\\\\-]+[a-zA-Z0-9]@([a-zA-Z0-9][a-zA-Z0-9\\\\-]*\\\\.)+[a-zA-Z]{2,4}$/

  • 1 What Is a Regular Expression?
  • 2 Pattern-Matching Functions
  • 2.1 Finding a Pattern
  • 2.2 Searching and Replacing
  • 2.3 Getting Control—The RegEx Metacharacters
  • 2.4 Searching for Patterns in Text Files
  • 2.5 Form Validation with PHP
  • 2.6 Help on the Web

Figs:

  1. Ouput of the phpinfo() function.
  2. The preg_match() function. Output from Example 1.
  3. Case-insensitive search
  4. Capturing subpatterns
  5. Matching all occurrences of a pattern
  6. Finding the starting position of each matched pattern
  7. Search for a pattern and replace it with another string
  8. Search an array and replace it with another array
  9. Evaluating the replacement side with the e modifier
  10. Splitting up a string by a specified delimiter with preg_split()
  11. Splitting with multiple delimiters
  12. Splitting up a word with the preg_split() function
  13. Splitting up a string with the preg_split() function
  14. The preg_grep() function
  15. The user is searching for a specific area code.
  16. The lines that matched the pattern are output
  17. The HTML form from
  18. After the user submits an invalid e-mail address, an error is shown
  19. The user has submitted a valid e-mail address.
  20. After successful validation with a regular expression.
  21. Using a regular expression to find a zip code.

 

Download PHP Regular Expressions and Pattern Matching pdf from devzone.zend.com, 70 pages, 638.27KB.
Related Books

Leave a Reply