Compiles a regular expression and executes it to match a source string. An optional substitution string may be specified to parse out information from the source string.
Kernel.bdh
StrRegexImmediate( in sSource : string, in sRegex : string, in sSubst : string optional, out sTarget : string optional, in nMaxTarget : number optional ): boolean;
true if a match of the regular expression in the string sSource could be found.
false on errors or if no match could be found. Use GetLastError and GetErrorMsg to query for more information.
Parameter | Description |
---|---|
sSource | String to be matched by the regular expression |
sRegex | Regular expression |
sSubst | String into which matched portions are substituted (optional) |
sTarget | String which receives the result of the substitution string (optional) |
nMaxTarget | Size of sTarget (optional) |
dcltrans transaction TMain var sRegex, sSource, sTarget : string; match : boolean; begin sSource := "SessionIDTest.asp?SessionID=SID8:44:43&" "Param2=Value2"; sRegex := "SID[0-9]+:[0-9]+:[0-9]+"; write("source = "+sSource); writeln; write("regex = "+sRegex); writeln; match := StrRegexImmediate(sSource, sRegex, "&", sTarget); if match then write("match: "+sTarget); writeln; else write("no match"); writeln; end; end TMain;
source = SessionIDTest.asp?SessionID=SID8:44:43&Param2=Value2 regex = SID[0-9]+:[0-9]+:[0-9]+ match: SID8:44:43
WebRegularExpressions01.bdf