54.4 GREP Function Signature 1
Returns the values of the input table that match a regular expression.
Syntax
GREP (
p_table IN apex_t_varchar2,
p_pattern IN VARCHAR2,
p_modifier IN VARCHAR2 DEFAULT NULL,
p_subexpression IN VARCHAR2 DEFAULT '0',
p_limit IN PLS_INTEGER DEFAULT NULL )
RETURN apex_t_varchar2;
Parameters
Parameters | Description |
---|---|
p_table |
The input table. |
p_pattern |
The regular expression. |
p_modifier |
The regular expression modifier. |
p_subexpression |
The subexpression which should be returned. If null, return the complete table value. If 0 (the default), return the matched expression. If > 0, return the subexpression value. You can also pass a comma separated list of numbers, to get multiple subexpressions in the result. |
p_limit |
Limitation for the number of elements in the return table. If null (the default), there is no limit. |
Example
Collect and print basenames of sql files in input collection.
declare
l_sqlfiles apex_t_varchar2;
begin
l_sqlfiles := apex_string.grep (
p_table => apex_t_varchar2('a.html','b.sql', 'C.SQL'),
p_pattern => '(\w+)\.sql',
p_modifier => 'i',
p_subexpression => '1' );
sys.dbms_output.put_line(apex_string.join(l_sqlfiles, ':'));
end;
-> b:C
Parent topic: APEX_STRING