Annotation of embedaddon/php/ext/ereg/tests/eregi_replace_basic_001.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test ereg() function : basic functionality
3: --FILE--
4: <?php
5: /* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
6: * Description: Replace regular expression
7: * Source code: ext/standard/reg.c
8: * Alias to functions:
9: */
10:
11: /*
12: * Test a number of simple, valid matches with eregi_replace
13: */
14:
15: echo "*** Testing ereg() : basic functionality ***\n";
16:
17: include(dirname(__FILE__) . '/regular_expressions.inc');
18:
19: $replacement = '[this is a replacement]';
20:
21: foreach ($expressions as $re) {
22: list($pattern, $match) = $re;
23: echo "--> Pattern: '$pattern'; match: '$match'\n";
24: var_dump(eregi_replace($pattern, $replacement, $match . ' this contains some matches ' . $match));
25: }
26:
27: echo "Done";
28: ?>
29: --EXPECTF--
30: *** Testing ereg() : basic functionality ***
31: --> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
32:
33: Deprecated: Function eregi_replace() is deprecated in %s on line %d
34: string(82) "--[this is a replacement]-- this contains some matches --[this is a replacement]--"
35: --> Pattern: '()'; match: ''
36:
37: Deprecated: Function eregi_replace() is deprecated in %s on line %d
38: string(695) "[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]"
39: --> Pattern: '()'; match: 'abcdef'
40:
41: Deprecated: Function eregi_replace() is deprecated in %s on line %d
42: string(983) "[this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement]"
43: --> Pattern: '[x]|[^x]'; match: 'abcdef'
44:
45: Deprecated: Function eregi_replace() is deprecated in %s on line %d
46: string(920) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement]"
47: --> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
48:
49: Deprecated: Function eregi_replace() is deprecated in %s on line %d
50: string(90) "--- [this is a replacement] --- this contains some matches --- [this is a replacement] ---"
51: --> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
52:
53: Deprecated: Function eregi_replace() is deprecated in %s on line %d
54: string(74) "[this is a replacement] this contains some matches [this is a replacement]"
55: --> Pattern: '\a'; match: 'a'
56:
57: Deprecated: Function eregi_replace() is deprecated in %s on line %d
58: string(118) "[this is a replacement] this cont[this is a replacement]ins some m[this is a replacement]tches [this is a replacement]"
59: --> Pattern: '[0-9][^0-9]'; match: '2a'
60:
61: Deprecated: Function eregi_replace() is deprecated in %s on line %d
62: string(74) "[this is a replacement] this contains some matches [this is a replacement]"
63: --> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
64:
65: Deprecated: Function eregi_replace() is deprecated in %s on line %d
66: string(152) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ this contains some matches 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
67: --> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
68:
69: Deprecated: Function eregi_replace() is deprecated in %s on line %d
70: string(66) "[this is a replacement]56789 this contains some matches 0123456789"
71: --> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
72:
73: Deprecated: Function eregi_replace() is deprecated in %s on line %d
74: string(66) "0123456789 this contains some matches 01234[this is a replacement]"
75: --> Pattern: '[[:blank:]]{1,10}'; match: '
76: '
77:
78: Deprecated: Function eregi_replace() is deprecated in %s on line %d
79: string(163) "
80: [this is a replacement]this[this is a replacement]contains[this is a replacement]some[this is a replacement]matches[this is a replacement]
81: [this is a replacement]"
82: --> Pattern: '[[:print:]]{3}'; match: ' a '
83:
84: Deprecated: Function eregi_replace() is deprecated in %s on line %d
85: string(254) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement] "
86: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>