The owa_pattern Package 6-5
6.5 owa_pattern.getpat procedure
This procedure converts a VARCHAR2 string into a owa_pattern.pattern data type
. Table 6–6
defines the properties of the owa_pattern.getpat procedure. procedure
owa_pattern.change mline
in out owa_text.multi_line
from_str in
varchar2 to_str
in varchar2
flags in
varchar2 DEFAULT NULL;
Parameters: line - the text to search in. The output value of this parameter is the altered string.
mline - the text to search in. This is a owa_text.multi_line data type
data type. The output value of this parameter is the altered string.
from_str - the regular expression to replace. to_str - the substitution pattern.
flags - whether or not the search is case-sensitive, and whether or not changes are to be made globally. If i is specified, the search is case-insensitive. If g is
specified, changes are made to all matches. Otherwise, the function stops after the first substitution is made.
Returns: As a function, it returns the number of substitutions made. If the flag `g is not
used, this number can only be 0 or 1 and only the first match is replaced. The flag `g specifies to replace all matches with the regular expression.
Example: Example 1:
owa_pattern.changeCats in pajamas, C.+in, red The regular expression matches the substring `Cats in. It then replaces this string
with ` red. The ampersand character indicates `Cats in, since thats what matched the regular expression. Thus, this procedure replaces the string `Cats in
pajamas with Cats in red pajamas. If you called this as a function instead of a procedure, the value it returns is 1, indicating that a single substitution has been
made.
Example 2: create or replace procedure test_pattern as theline VARCHAR2256;
num_found integer; begin
theline := what is the goal?; num_found := owa_pattern.changetheline, goal, idea, g;
htp.printnum_found; -- num_found is 1 htp.printtheline; -- theline is what is the idea?
end; show errors
Table 6–5 Cont. owa_pattern.change function and procedure
Properties Definitions
6-6 Oracle Fusion Middleware PLSQL Web Toolkit Reference
6.6 owa_pattern.match function