regular_expressions.inc 823 B

123456789101112131415161718192021222324
  1. <?php
  2. /**
  3. * POSIX regular expressions each coupled with a string that they match,
  4. * based on documentation on http://www.tin.org/bin/man.cgi?section=7&topic=regex .
  5. */
  6. $expressions = array(
  7. //array(pattern, string to match)
  8. array('..(a|b|c)(a|b|c)..', '--- ab ---'),
  9. array('()', ''),
  10. array('()', 'abcdef'),
  11. array('[x]|[^x]', 'abcdef'),
  12. array('(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)', '--- aaa bbb ccc ddd ---'),
  13. array('\\\\\`\^\.\[\$\(\)\|\*\+\?\{\\\'', '\\`^.[$()|*+?{\''),
  14. array('\\a', 'a'),
  15. array('[0-9][^0-9]', '2a'),
  16. array('^[[:alnum:]]{62,62}$', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'),
  17. array('^[[:digit:]]{5}', '0123456789'),
  18. array('[[:digit:]]{5}$', '0123456789'),
  19. array('[[:blank:]]{1,10}', "\n \t"),
  20. array('[[:print:]]{3}', " a "),
  21. );
  22. ?>