Regular Expression

ECMAScript Syntax Grammar


The REGEX Syntax implemented in ASTER is the ECMAScript (JavaScript) version.

About Regular Expressions
REGEX

ECMAScript is a JavaScript standard specification defined by an organization called ECMA. It provides a mechanism to standardize the language specification and maintain compatibility in order to run commonly on different browsers.

There are multiple variants of regular expression grammars, and in modern times there are many texts on the web that teach in the ECMAScript version of the grammar, so there are many opportunities to learn regular expressions in ECMAScript Regular Expression Grammars.

It is based on a notation devised by American mathematician Stephen Cole Kleene in 1943, and was later implemented by Kenneth Lane Thompson in Ken’s CTSS QED, an editor for mainframe computers, which incorporated the first “regular expression” in computer history.

Regular expressions, which evolved on UNIX, have become an essential technology for handling large amounts of text on all modern computers.


regex101.com

Because regular expressions require a certain amount of trial and error, we recommend using a useful tool called regex101.com to check their operation in your browser.

It offers a SAVE & SHARE feature, allowing you to share results with a short URL.

Additionally, the Match Information section lists the search results and visually displays the submatches obtained when using capture groups, making debugging and testing more efficient.




Regular expression functions available in ASTER

  • REGEX Search :: Partial Match
  • REGEX Search :: Exact Match
  • REGEX Replace

You can use regular expressions for Searching and Replacing text. The basic syntax is as follows.

Pattern Japanese English
x|y 代替演算子(オルタネーション演算子) The alternation operator
[xyz] 文字クラス Character class
[^xyz] 文字集合の否定 Negated character class
\1 後方参照 Backreference
(x) キャプチャグループ Capturing Groups
{n} 固定量指定子 Fixed quantifier
{n,m} 貪欲量指定子 Greedy quantifier
(?:x) 非キャプチャグループ Non-Capturing Groups
(?=x) 肯定的先読み Positive lookahead
(?!x) 否定的先読み Negative lookahead

Control Characters

Due to the specifications of CF25, the transmission of control character strings remains limited. There are control characters within the replacement process that are not supported.

Pattern Matching Search

Since this is a pattern matching search, processing is heavier than a normal string search.

Specification

The C++20 STL does Not support All Features of ECMAScript REGEX, and LookBehinds cannot be used. Named Capturing Groups are also Not supported.

(?<=T.+e)S.+t

Although the above syntax is correct, it will result in a “Syntax Error” on ASTER because Lookbehinds (REGEX) cannot be used.

This regular expression matches any string that starts with S and ends with t, following a string that starts with T and ends with e.

Example of confirmed operation with regex101