It's about the function name (those are functions, not VIs).
The top one is actually "Match Pattern", the bottom one is "Match Regular Expression".
"Match Pattern" was added decades ago. Back then the input name "regular expression" was probably as good as any. It still is a valid name on it's own, just not in the context as we know it now.
"regular expression" is now tightly linked to the PCRE library (mostly compatibly with "Match Regular Expression"). But there's no rule "regular expression" has to be a PCRE expression. It's just an expression that is, well, regular. And the match pattern function does expect an expression that is regular.
I suspected something like this. The match pattern function sort of can do regex, but not all. In the end it's a irritatingly named input.
To complete what Wiebe said, the help of "Match Pattern" says:
"The Match Pattern function is compatible with a limited set of regular expressions and does not support character grouping, alternate pattern matching, backreferences, or non-greedy quantification."
So it is a regular expression, but with fewer options than with function "Match Regular Expression".
Regards,
Raphaël.
On the topic of regular expressions:
Add Match Regular Expression sub VI - NI Community
Allow replace with reg ex result in Text Search Results dialog - NI Community
And on that last topic:
Allow replace with empty string in Text Search Results dialog - NI Community
(Shameless plugs)
@raphschru wrote:
To complete what Wiebe said, the help of "Match Pattern" says:
"The Match Pattern function is compatible with a limited set of regular expressions and does not support character grouping, alternate pattern matching, backreferences, or non-greedy quantification."
So it is a regular expression, but with fewer options than with function "Match Regular Expression".
Regards,
Raphaël.
I always thought of it as "regex lite".
@billko wrote:
@raphschru wrote:
To complete what Wiebe said, the help of "Match Pattern" says:
"The Match Pattern function is compatible with a limited set of regular expressions and does not support character grouping, alternate pattern matching, backreferences, or non-greedy quantification."
So it is a regular expression, but with fewer options than with function "Match Regular Expression".
Regards,
Raphaël.
I always thought of it as "regex lite".
"regex too lite" for me 😁.
wiebe@CARYA wrote:
@billko wrote:
@raphschru wrote:
To complete what Wiebe said, the help of "Match Pattern" says:
"The Match Pattern function is compatible with a limited set of regular expressions and does not support character grouping, alternate pattern matching, backreferences, or non-greedy quantification."
So it is a regular expression, but with fewer options than with function "Match Regular Expression".
Regards,
Raphaël.
I always thought of it as "regex lite".
"regex too lite" for me 😁.
That's a better description. I actually never use this for that reason. It's either "too complicated" or "not complicated enough" for what I need it to do.
wiebe@CARYA wrote:
@billko wrote:I always thought of it as "regex lite".
"regex too lite" for me 😁.
Quite a bit slower though. When Match Pattern is enough it's the much preferred alternative.
This simple test, 100k characters random from ascii 32 - 132 and turned into a constant, then filtered as you can see, takes 6 vs 75 ms!
often, I use the regex modus of the function "search and replace string" instead of match pattern.
If you want to search for more complex patterns, such as patterns that contain character grouping, alternate pattern matching, backreferences, or non-greedy quantification, configure the function for advanced regular expression searches or use the Match Regular Expression function.