v2026.6.4
All Bundles
Bundle Regular expression matching and replacement. RegEx compiles a pattern once and supports full match, substring search, capture groups, and global replacement. Included in lang.obl.

RegEx

Regular expression engine.

Support for following patterns:

  • any ‐ .
  • optional ‐ ?
  • zero or more repetitions ‐ *
  • one or more repetitions ‐ +
  • first single match ‐ ^
  • last single match ‐ $
  • (one|two|three) ‐ group
  • [start-end] ‐ range

Support for following special groups:

  • word ‐ \w
  • not word ‐ \W
  • digit ‐ \d
  • not digit ‐ \D
  • white space ‐ \s
  • not white space ‐ \S
  • repeat ‐ {least, most}

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();
};

Operations

Find #

Finds all occurrences

method : public : Find(stream_in:String) ~ Vector<Result>

Parameters

NameTypeDescription
stream_inStringstring to match against

Return

TypeDescription
Vector<Result>vector of string matches

Example

re := RegEx->New("\\d+");
results := re->Find("1 cat, 2 dogs, 3 birds")<Result>;
each(r := results) {
  r->GetValue()->PrintLine();
};

FindFirst #

Matches the first occurrence

method : public : FindFirst(stream_in:String) ~ Result

Parameters

NameTypeDescription
stream_inStringstring to match against

Return

TypeDescription
Resultmatched string if found, empty string otherwise

Example

re := RegEx->New("[A-Z][a-z]+");
result := re->FindFirst("Hello World");
if(result <> Nil) {
  result->GetValue()->PrintLine();
  Console->PrintLine(result->GetStart());
};

IsOk #

Check of the regex was parsed correctly

method : public : IsOk() ~ Bool

Return

TypeDescription
Booltrue if parsed, false otherwise

Example

re := RegEx->New("[a-z]+");
if(re->IsOk()) {
  "pattern compiled ok"->PrintLine();
};

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

Example

re := RegEx->New("\\w+");
matched := re->Match("hello world");
matched->PrintLine();

Match #

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

Example

re := RegEx->New("\\d+");
matched := re->Match("skip 42 here", 5);
matched->PrintLine();

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

Example

re := RegEx->New("\\d{4}-\\d{2}-\\d{2}");
if(re->MatchExact("2025-06-15")) {
  "valid date format"->PrintLine();
};

New # constructor

Default constructor

New(stream_in:String)

Parameters

NameTypeDescription
stream_inStringregex pattern

Example

re := RegEx->New("\\d+");
if(re->IsOk()) {
  results := re->Find("order 42 ships on day 7")<Result>;
  each(r := results) {
    r->GetValue()->PrintLine();
  };
};

ReplaceAll #

Replaces all occurrences of the given string

method : public : ReplaceAll(stream_in:String, replace:String) ~ String

Parameters

NameTypeDescription
stream_inStringstring to match against
replaceStringstring to replace the match with

Return

TypeDescription
Stringreplaced string

Example

re := RegEx->New("\\d+");
result := re->ReplaceAll("order 42 ships on day 7", "NUM");
result->PrintLine();

ReplaceFirst #

Replaces the first occurrence with the given string

method : public : ReplaceFirst(stream_in:String, replace:String) ~ String

Parameters

NameTypeDescription
stream_inStringstring to match against
replaceStringstring to replace the match with

Return

TypeDescription
Stringreplaced string

Example

re := RegEx->New("\\d+");
result := re->ReplaceFirst("order 42 ships on day 7", "NUM");
result->PrintLine();