First time here? Check out the Help page!
1 | initial version |
Support for regular expressions (regex) has been added by @MarkAdams in PR#6017, circa E+ 8.7.
The I/O reference guide shows a simple example of a regex for Key Value here and links to a page showing the Regex flavor that is being used: google/re2.
It also mentions that no regex can contain a comma ,
even if it is valid regex syntax (eg: between 2 and 5 digits, \d{2,5}
, isn't valid).
Even though there isn't support for re2 regex flavor, I strongly recommend https://regex101.com/ as a test bed. It's a website that I wished existed when I got started with regexes, as it allows to quickly test your regex, and will decompose the behavior or a given regex.
I'll give some fresh examples, because more is better.
If given the following nodes:
SalesFloor InletNode 1
SalesFloor InletNode 2
SalesFloor InletNode 3
Office InletNode 1
Office InletNode 2
Office InletNode 3
SalesFloor OutletNode 1
SalesFloor OutletNode 2
SalesFloor OutletNode 3
Office OutletNode 1
Office OutletNode 2
Office OutletNode 3
SalesFloor InletNode \d+
(\d+
means any digit, one or more, prefer more (=greedy))
SalesFloor (Inlet|Outlet)Node \d+
.*InletNode \d+
.*
means any character, zero or more times, greedy.
.*InletNode [1-2]
Typically, you would do .*InletNode \d{1,2}
. But like the I/O said, you can't use a comma. So you have to explicitly list the digits here: we want at least one, maybe two, that's it
.*InletNode \d\d*$
I'm not 100% sure the $
= end of text anchor is supported, but I think it is.
It isn't even required here because E+ uses RE2::FullMatch
(see here) which requires the regexp to match the entire input text (as opposed to RE2::PartialMatch
which looks for a match for a substring of the input text)