Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / ereg / tests / ereg_basic_001.phpt
blobe9dad37636e458f5dd5040ec767c6007f36dd000
1 --TEST--
2 Test ereg() function : basic functionality (with $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  */
12  * Test a number of simple, valid matches with ereg, specifying $regs
13  */
15 echo "*** Testing ereg() : basic functionality ***\n";
17 include(dirname(__FILE__) . '/regular_expressions.inc');
19 foreach ($expressions as $re) {
20         list($pattern,$string) = $re;
21         echo "--> Pattern: '$pattern'; string: '$string'\n";
22         var_dump(ereg($pattern, $string, $regs));
23         var_dump($regs);
26 echo "Done";
28 --EXPECTF--
29 *** Testing ereg() : basic functionality ***
30 --> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
32 Deprecated: Function ereg() 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"
42 --> Pattern: '()'; string: ''
44 Deprecated: Function ereg() is deprecated in %s on line %d
45 int(1)
46 array(2) {
47   [0]=>
48   bool(false)
49   [1]=>
50   bool(false)
52 --> Pattern: '()'; string: 'abcdef'
54 Deprecated: Function ereg() is deprecated in %s on line %d
55 int(1)
56 array(2) {
57   [0]=>
58   bool(false)
59   [1]=>
60   bool(false)
62 --> Pattern: '[x]|[^x]'; string: 'abcdef'
64 Deprecated: Function ereg() is deprecated in %s on line %d
65 int(1)
66 array(1) {
67   [0]=>
68   string(1) "a"
70 --> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
72 Deprecated: Function ereg() 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"
88 --> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
90 Deprecated: Function ereg() is deprecated in %s on line %d
91 int(14)
92 array(1) {
93   [0]=>
94   string(14) "\`^.[$()|*+?{'"
96 --> Pattern: '\a'; string: 'a'
98 Deprecated: Function ereg() is deprecated in %s on line %d
99 int(1)
100 array(1) {
101   [0]=>
102   string(1) "a"
104 --> Pattern: '[0-9][^0-9]'; string: '2a'
106 Deprecated: Function ereg() is deprecated in %s on line %d
107 int(2)
108 array(1) {
109   [0]=>
110   string(2) "2a"
112 --> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
114 Deprecated: Function ereg() is deprecated in %s on line %d
115 int(62)
116 array(1) {
117   [0]=>
118   string(62) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
120 --> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
122 Deprecated: Function ereg() is deprecated in %s on line %d
123 int(5)
124 array(1) {
125   [0]=>
126   string(5) "01234"
128 --> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
130 Deprecated: Function ereg() is deprecated in %s on line %d
131 int(5)
132 array(1) {
133   [0]=>
134   string(5) "56789"
136 --> Pattern: '[[:blank:]]{1,10}'; string: '
137         '
139 Deprecated: Function ereg() is deprecated in %s on line %d
140 int(2)
141 array(1) {
142   [0]=>
143   string(2) "   "
145 --> Pattern: '[[:print:]]{3}'; string: ' a '
147 Deprecated: Function ereg() is deprecated in %s on line %d
148 int(3)
149 array(1) {
150   [0]=>
151   string(3) " a "
153 Done