Annotation of embedaddon/php/ext/ereg/tests/eregi_basic_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test eregi() function : basic functionality (with $regs)
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : proto int eregi(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: /*
! 12: * Test a number of simple, valid matches with eregi, specifying $regs
! 13: */
! 14:
! 15: echo "*** Testing eregi() : basic functionality ***\n";
! 16:
! 17: include(dirname(__FILE__) . '/regular_expressions.inc');
! 18:
! 19: foreach ($expressions as $re) {
! 20: list($pattern,$string) = $re;
! 21: echo "--> Pattern: '$pattern'; string: '$string'\n";
! 22: var_dump(eregi($pattern, $string, $regs));
! 23: var_dump($regs);
! 24: }
! 25:
! 26: echo "Done";
! 27: ?>
! 28: --EXPECTF--
! 29: *** Testing eregi() : basic functionality ***
! 30: --> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
! 31:
! 32: Deprecated: Function eregi() is deprecated in %s on line %d
! 33: int(6)
! 34: array(3) {
! 35: [0]=>
! 36: string(6) "- ab -"
! 37: [1]=>
! 38: string(1) "a"
! 39: [2]=>
! 40: string(1) "b"
! 41: }
! 42: --> Pattern: '()'; string: ''
! 43:
! 44: Deprecated: Function eregi() is deprecated in %s on line %d
! 45: int(1)
! 46: array(2) {
! 47: [0]=>
! 48: bool(false)
! 49: [1]=>
! 50: bool(false)
! 51: }
! 52: --> Pattern: '()'; string: 'abcdef'
! 53:
! 54: Deprecated: Function eregi() is deprecated in %s on line %d
! 55: int(1)
! 56: array(2) {
! 57: [0]=>
! 58: bool(false)
! 59: [1]=>
! 60: bool(false)
! 61: }
! 62: --> Pattern: '[x]|[^x]'; string: 'abcdef'
! 63:
! 64: Deprecated: Function eregi() is deprecated in %s on line %d
! 65: int(1)
! 66: array(1) {
! 67: [0]=>
! 68: string(1) "a"
! 69: }
! 70: --> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
! 71:
! 72: Deprecated: Function eregi() is deprecated in %s on line %d
! 73: int(15)
! 74: array(6) {
! 75: [0]=>
! 76: string(15) "aaa bbb ccc ddd"
! 77: [1]=>
! 78: string(1) "a"
! 79: [2]=>
! 80: string(2) "aa"
! 81: [3]=>
! 82: string(3) "bbb"
! 83: [4]=>
! 84: string(3) "ccc"
! 85: [5]=>
! 86: string(3) "ddd"
! 87: }
! 88: --> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
! 89:
! 90: Deprecated: Function eregi() is deprecated in %s on line %d
! 91: int(14)
! 92: array(1) {
! 93: [0]=>
! 94: string(14) "\`^.[$()|*+?{'"
! 95: }
! 96: --> Pattern: '\a'; string: 'a'
! 97:
! 98: Deprecated: Function eregi() is deprecated in %s on line %d
! 99: int(1)
! 100: array(1) {
! 101: [0]=>
! 102: string(1) "a"
! 103: }
! 104: --> Pattern: '[0-9][^0-9]'; string: '2a'
! 105:
! 106: Deprecated: Function eregi() is deprecated in %s on line %d
! 107: int(2)
! 108: array(1) {
! 109: [0]=>
! 110: string(2) "2a"
! 111: }
! 112: --> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
! 113:
! 114: Deprecated: Function eregi() is deprecated in %s on line %d
! 115: int(62)
! 116: array(1) {
! 117: [0]=>
! 118: string(62) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
! 119: }
! 120: --> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
! 121:
! 122: Deprecated: Function eregi() is deprecated in %s on line %d
! 123: int(5)
! 124: array(1) {
! 125: [0]=>
! 126: string(5) "01234"
! 127: }
! 128: --> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
! 129:
! 130: Deprecated: Function eregi() is deprecated in %s on line %d
! 131: int(5)
! 132: array(1) {
! 133: [0]=>
! 134: string(5) "56789"
! 135: }
! 136: --> Pattern: '[[:blank:]]{1,10}'; string: '
! 137: '
! 138:
! 139: Deprecated: Function eregi() is deprecated in %s on line %d
! 140: int(2)
! 141: array(1) {
! 142: [0]=>
! 143: string(2) " "
! 144: }
! 145: --> Pattern: '[[:print:]]{3}'; string: ' a '
! 146:
! 147: Deprecated: Function eregi() is deprecated in %s on line %d
! 148: int(3)
! 149: array(1) {
! 150: [0]=>
! 151: string(3) " a "
! 152: }
! 153: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>