ereg_basic_002.phpt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. --TEST--
  2. Test ereg() function : basic functionality (without $regs)
  3. --FILE--
  4. <?php
  5. /* Prototype : proto int ereg(string pattern, string string [, array registers])
  6. * Description: Regular expression match
  7. * Source code: ext/standard/reg.c
  8. * Alias to functions:
  9. */
  10. /*
  11. * Test a number of simple, valid matches with ereg, without specifying $regs
  12. */
  13. echo "*** Testing ereg() : basic functionality ***\n";
  14. include(dirname(__FILE__) . '/regular_expressions.inc');
  15. foreach ($expressions as $re) {
  16. list($pattern,$string) = $re;
  17. echo "--> Pattern: '$pattern'; string: '$string'\n";
  18. var_dump(ereg($pattern, $string));
  19. }
  20. echo "Done";
  21. ?>
  22. --EXPECTF--
  23. *** Testing ereg() : basic functionality ***
  24. --> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
  25. Deprecated: Function ereg() is deprecated in %s on line %d
  26. int(1)
  27. --> Pattern: '()'; string: ''
  28. Deprecated: Function ereg() is deprecated in %s on line %d
  29. int(1)
  30. --> Pattern: '()'; string: 'abcdef'
  31. Deprecated: Function ereg() is deprecated in %s on line %d
  32. int(1)
  33. --> Pattern: '[x]|[^x]'; string: 'abcdef'
  34. Deprecated: Function ereg() is deprecated in %s on line %d
  35. int(1)
  36. --> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
  37. Deprecated: Function ereg() is deprecated in %s on line %d
  38. int(1)
  39. --> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
  40. Deprecated: Function ereg() is deprecated in %s on line %d
  41. int(1)
  42. --> Pattern: '\a'; string: 'a'
  43. Deprecated: Function ereg() is deprecated in %s on line %d
  44. int(1)
  45. --> Pattern: '[0-9][^0-9]'; string: '2a'
  46. Deprecated: Function ereg() is deprecated in %s on line %d
  47. int(1)
  48. --> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
  49. Deprecated: Function ereg() is deprecated in %s on line %d
  50. int(1)
  51. --> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
  52. Deprecated: Function ereg() is deprecated in %s on line %d
  53. int(1)
  54. --> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
  55. Deprecated: Function ereg() is deprecated in %s on line %d
  56. int(1)
  57. --> Pattern: '[[:blank:]]{1,10}'; string: '
  58. '
  59. Deprecated: Function ereg() is deprecated in %s on line %d
  60. int(1)
  61. --> Pattern: '[[:print:]]{3}'; string: ' a '
  62. Deprecated: Function ereg() is deprecated in %s on line %d
  63. int(1)
  64. Done