xref: /PHP-5.5/ext/ereg/tests/eregi_basic_002.phpt (revision 1881091e)
1--TEST--
2Test eregi() function : basic functionality  (without $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, without specifying $regs
13 */
14
15echo "*** Testing eregi() : basic functionality ***\n";
16
17include(dirname(__FILE__) . '/regular_expressions.inc');
18
19foreach ($expressions as $re) {
20	list($pattern,$string) = $re;
21	echo "--> Pattern: '$pattern'; string: '$string'\n";
22	var_dump(eregi($pattern, $string));
23}
24
25echo "Done";
26?>
27--EXPECTF--
28*** Testing eregi() : basic functionality ***
29--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
30
31Deprecated: Function eregi() is deprecated in %s on line %d
32int(1)
33--> Pattern: '()'; string: ''
34
35Deprecated: Function eregi() is deprecated in %s on line %d
36int(1)
37--> Pattern: '()'; string: 'abcdef'
38
39Deprecated: Function eregi() is deprecated in %s on line %d
40int(1)
41--> Pattern: '[x]|[^x]'; string: 'abcdef'
42
43Deprecated: Function eregi() is deprecated in %s on line %d
44int(1)
45--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
46
47Deprecated: Function eregi() is deprecated in %s on line %d
48int(1)
49--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
50
51Deprecated: Function eregi() is deprecated in %s on line %d
52int(1)
53--> Pattern: '\a'; string: 'a'
54
55Deprecated: Function eregi() is deprecated in %s on line %d
56int(1)
57--> Pattern: '[0-9][^0-9]'; string: '2a'
58
59Deprecated: Function eregi() is deprecated in %s on line %d
60int(1)
61--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
62
63Deprecated: Function eregi() is deprecated in %s on line %d
64int(1)
65--> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
66
67Deprecated: Function eregi() is deprecated in %s on line %d
68int(1)
69--> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
70
71Deprecated: Function eregi() is deprecated in %s on line %d
72int(1)
73--> Pattern: '[[:blank:]]{1,10}'; string: '
74 	'
75
76Deprecated: Function eregi() is deprecated in %s on line %d
77int(1)
78--> Pattern: '[[:print:]]{3}'; string: ' a '
79
80Deprecated: Function eregi() is deprecated in %s on line %d
81int(1)
82Done
83