RegEx Text Filter

Navigation:  Widget Designer > Nodes > Filter Nodes > Text Filter Nodes >

RegEx Text Filter

prev main next

Navigation:  Widget Designer > Nodes > Filter Nodes > Text Filter Nodes >

RegEx Text Filter

prev main next

Loading...

The RegEx Text Filter node extends the "Find and Replace" feature known from common text editor software with RegEx expressions. A Regular Expression (short: RegEx) is a pattern that describes a certain combination / amount of text including word, number and (non-) printable characters. By supporting character classes (wild cards), grouping, back-references, etc. the RegEx engine allows very flexible and efficient text processing.
There are different RegEx flavors i.e. implementations in various programming languages. Widget Designer uses the RegEx the .NET framework library.

Below you will find a few examples how regular expressions work. For further information and complete description of supported character classes, operators and constructs, please visit:
https://msdn.microsoft.com/en-us/library/az24scfc%28v=vs.110%29.aspx

Note: The Filter node "RegEx Compare" also searches for text that matches the used RegEx but does not replace it, it simply returns a TRUE or FALSE.

The node can be found under Nodes > Filter Nodes > Text > RegEx Text

wd_nodes_filter_regex-text

Node properties

Input:
Choose an input node from the drop-down or enter a text.

Pattern:
Enter a regular expression describing the text you want to search for.

Replacement:
Enter a regular expression that should replace a found pattern.

Node control

With Widget Designer version 6, all nodes support so called node commands. Node commands access functions (i.e methods) from a node and / or set a parameter (i.e. property).

Enter "node", followed by the according ID and a dot and a list will pop up showing all available commands for the node. For instance, Node1.TintColor.SetRGB(125,0,255), colors the node in purple.
In addition, the node properties with a parameter ID (the small superscript number) can be edited via the command Node1.SetParam(ID,new Value) or WDNodeSetParam(NodeID,ParamID,Value).

Node output values

The Node generates the following output:

- Output

Examples for Regular Expressions

These examples are based on the input string:
A cat wears 99 hats - What? - Yes, yes!

Pattern

Replace

Output

Meaning

[a-z]+

1

A 1 1 99 1 - W1? - Y1, 1!

Searches case-sensitive any letter from character group "a-z" that occurs at least once. Replaces with digit "1"

(cat)[^\?]*

$1

A cat? - Yes, yes!

Searches for a string that starts with "cat" followed by any character that is not a "?" occurring zero or more times. By putting "cat" in round brackets, it becomes group no.1. Replaces with first group.

[^a-zA-Z0-9 ]

 

A cat wears 22 hats  What  Yes yes

Searches for any character that is not a-z nor A-Z nor 0-9 nor a space. Replaces with nothing (i.e. it's erased).
The mentioned characters can be described shorter with the "character class" word character "\w". Hence, we can search alternatively for the negated group.

[^\w]

\W

(?i)yes

yes

A cat wears 22 hats - What? - yes, yes!

Searches case-insensitive for the word "yes". Replaces with "yes".

For further information and complete description please visit:
https://msdn.microsoft.com/en-us/library/az24scfc%28v=vs.110%29.aspx