About Regex

A regular expression, in short regex, is a sequence of characters that define a search pattern. Usually this pattern is used by string searching algorithms for "find" or "find and replace" operations on strings, or for input validation.

We provide you within the AM Composer three different activities you can use to perform regex algorithms. All of our activities provide you guidance configuring your pattern in form of a wizard.

  1. Is Regex Match: Checks whether a defined pattern or keyword occurs inside an input text and returns true or false.
  2. Regex Matches: Checks for a defined pattern or keyword inside an input text and returns a list of all matches found.
  3. Regex Replace: Checks for a defined pattern or keyword inside an input text and replaces all matches by a user defined replacement string.

 

In case that you want to configure the regex pattern yourself, you can directly set the pattern in the properties grid of the activities. Guidance to build your pattern can be found in the CheatSheet below and in vaious webpages as https://www.regular-expressions.info/. For manual pattern configuration the wizard provided on https://regex101.com/ might be helpful.

 

CheatSheet

Type Pattern Description
Character Classes . Any character except newline
\w\d\s Word, digit, whitepace
\W\D\S Not word, digit, whitespace
[abc] Any a, b or c
[^abc] Not a, b or c
[a-k] Characters between a and k
   
Anchors ^abc$ Start / end of String
\b\B Word, not-word boundry
   
Escaped Characters \.\*\\ Escaped special characters
\t\n\r Tab, linefeed, carriage return
   
Groups & Lookaround (abc) Capture group
\1 Backreference to group #1
(?:abc) Non-capturing group
(?=abc) Positive lookahead
(?!abc) Negative lookahead
   
Quantifiers & Alternation a* 0 or more
a+ 1 or more
a? 0 or 1
a{2} Exactly 2
a{2,} Two or more
a{1,3} Between one and three
ab|cd Match ab or cd

 

 

 

Was this article helpful?
0 out of 0 found this helpful