توضیحات
این تابع این امکان را میدهد تا یکسری کاراکتر را در رشتهای جاگزین مجموعهای از کاراکترها کرد.دستور
تابع REGEXP_REPLACE به صورت زیر نوشته میشود:|
1 |
REGEXP_REPLACE( string, pattern [, replacement_string [, start_position [, nth_appearance [, match_parameter ] ] ] ] ) |
مثال
مثالی از خروجی تابع REGEXP_REPLACE را مشاهده میکنیم:|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 |
SELECT REGEXP_REPLACE ('TechOnTheNet is a great resource', '^(\S*)', 'CheckYourMath')FROM dual;Result: 'CheckYourMath is a great resource'SELECT REGEXP_REPLACE ('2, 5, and 10 are numbers in this example', '\d', '#')FROM dual;Result: '#, #, and ## are numbers in this example'SELECT REGEXP_REPLACE ('2, 5, and 10 are numbers in this example', '(\d)(\d)', '#')FROM dual;Result: '2, 5, and # are numbers in this example'SELECT REGEXP_REPLACE (address, '(\d)(\d)', 'TBD')FROM contacts;SELECT REGEXP_REPLACE ('Anderson', 'a|e|i|o|u', 'G')FROM dual;Result: 'AndGrsGn'SELECT REGEXP_REPLACE ('Anderson', 'a|e|i|o|u', 'G', 1, 0, 'i')FROM dual;Result: 'GndGrsGn' |