WEM Community - Forum Thread

>

>

NEW RegEx Functions

Direct link to this thread: forum.wem.io/link?threadid=459

NEW RegEx Functions
0 replies

2021-06-23 14:12
last edited: 2021-06-23 14:35

By: RalphC (WEM)

Moderator

With the latest release (June 23, 2021), we've added 3 new functions for use with Regular Expressions.

RegExIsMatch(Pattern, Text)

yields boolean, test for a match of Pattern in Text
example RegExIsMatch("([0-9:]+)", "Yes the match is at 20:15")
result true

RegExMatches(Pattern, Text)

yields array of strings, the Matching Results of Pattern in Text
example RegExMatches("\\b\\w+es\\b", "There are matches in this line, but who writes these notes anyway?")
result matches, writes, notes

RegExReplace(Pattern, SourceText, ReplaceText)

yields ChangedText, where Pattern is replaced by ReplaceText in SourceText.
example RegExReplace("\\d{3}", "Triple (3) numbers like 123 are replaced by zeroes. Some but not all of these 5-niners (99999) become zeroes, and a phonenumber like 020-2402129?", "000")
result Triple (3) numbers like 000 are replaced by zeroes. Some but not all of these 5-niners (00099) become zeroes, and a phonenumber like 000-0000009?

Additional resources regarding Regular Expressions:

C# cheatsheet links
https://www.mikesdotnetting.com/article/46/c-regular-expressions-cheat-sheet
https://www.keycdn.com/support/regex-cheatsheet

PDF syntax cheatsheets
Cheatsheet From Microsoft
Quick Reference from Microsoft
Another good cheatsheet

Basic Examples and background
Some examples from Google
Wikipedia

Ralph - WEM Xpert since 2011

"I speak to machines with the voice of humanity"
-- Marillion, Man of a thousand faces --

Be the first to comment on this thread