All Bundles

RegEx

Regular expression engine.

Support for following patterns:

Support for following special groups:

Operations

Code example:

output := HttpsClient->New()->QuickGet(Web.HTTP.Url->New(url))->ToString();
output_len := output->Size();
"URL: {$output}, read: {$output_len} character(s)"->PrintLine();

"running regex..."->PrintLine();      
expr := "(href|HREF|src|SRC)=(\"|')(http://|https://|/)?((\\w|\\d|-|_)+(\\.|/)?)+(\\?(\\w|\\d|-|_)+=(\\w|\\d|-|_)+)?(&(\\w|\\d|-|_)+=(\\w|\\d|-|_)+)?(\"|')";

found := Query.RegEx.RegEx->New(expr)->Find(output)<Result>;
"---"->PrintLine();
each(i : found) {
   found->Get(i)->ToString()->PrintLine();
};

New

Default constructor

New(stream_in:String)
Parameters
NameTypeDescription
stream_inStringregex pattern

Find

Finds all occurrences

method : public : native : Find(stream_in:String) ~ Vector<Result>
Parameters
NameTypeDescription
stream_inStringstring to match against

Return
TypeDescription
Vector<Result>vector of string matches

FindFirst

Matches the first occurrence

method : public : native : FindFirst(stream_in:String) ~ Result
Parameters
NameTypeDescription
stream_inStringstring to match against

Return
TypeDescription
Resultmatched string if found, empty string otherwise

IsOk

Check of the regex was parsed correctly

method : public : IsOk() ~ Bool
Return
TypeDescription
Booltrue if parsed, false otherwise

Match

Matches as much of the string as possible

method : public : Match(stream_in:String) ~ String
Parameters
NameTypeDescription
stream_inStringstring to match against

Return
TypeDescription
Stringmatched string if found, empty string otherwise

Matches as much of the string as possible

method : public : Match(stream_in:String, offset:Int) ~ String
Parameters
NameTypeDescription
stream_inStringstring to match against
offsetIntoffset into the to match against

Return
TypeDescription
Stringmatched string if found, empty string otherwise

MatchExact

Looks for an exact regex match

method : public : MatchExact(stream_in:String) ~ Bool
Parameters
NameTypeDescription
stream_inStringstring to match against

Return
TypeDescription
Booltrue if exact, false otherwise

ReplaceAll

Replaces all occurrences of the given string

method : public : native : ReplaceAll(stream_in:String, replace:String) ~ String
Parameters
NameTypeDescription
stream_inStringstring to match against
replaceStringstring to replace the match with

Return
TypeDescription
Stringreplaced string

ReplaceFirst

Replaces the first occurrence with the given string

method : public : native : ReplaceFirst(stream_in:String, replace:String) ~ String
Parameters
NameTypeDescription
stream_inStringstring to match against
replaceStringstring to replace the match with

Return
TypeDescription
Stringreplaced string