LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

match pattern anomaly?

I agree the icon is incorrect. But I'd still say the behaviour is correct. The first instance of an empty string is at the very beginning of each string. b* matches an empty string so the first instance is at position 0. If you need at least one instance use b+ as reg. exp. instead.
0 Kudos
Message 11 of 19
(1,195 Views)
In all other languages and operating systems, * matches any number of any characters.  Like in a cmd line, b* will match anything beginning with b (ba, bbbbb, bqwerty).  Why must Labview be different?  With an input string of abbc, and a pattern of b*, using the * convention of almost all other languages, the outputs would be: before=a, match=bbc, after=<blank>.  But nooooo, Labview has to define it differently so as to confuse everyone and make them learn two interpretations of *.  Same with question mark.  Pattern b? should return before=a, match=bb, after=c.  Without having to read the help files, this is what I would expect.  I wish this was the way it was.  But its too late now, everyone is used to the unique Labview definitions.
- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 19
(1,175 Views)
"In all other languages and operating systems, * matches any number of any characters.  Like in a cmd line, b* will match anything beginning with b (ba, bbbbb, bqwerty).  Why must Labview be different?"

Is this so bad?  The function is returning what the help says it should.  And ALL other languages? You sure?  I know it's a typical wildcard, but is it true that ALL other languages use this as a "anything" wildcard?  This would seem to suggest otherwise for C at least......

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 13 of 19
(1,159 Views)
No it isn't so bad.  In fact, once you are used to the syntax, it isn't bad at all.  Maybe * isn't a wildcard for EVERY other language, but it is pretty common amongst windows users.  My question is why didn't the Labview developers stick with the commonality?  It would have made life just a little easier.
- tbob

Inventor of the WORM Global
0 Kudos
Message 14 of 19
(1,156 Views)
They did stick with commonality, LV implements match pattern using regular expression syntax. Match pattern is a probably a DFA and match regular expression a NFA (if your curious on why there's two functions). Regular expressions are more common than * and ? in programming languages (perl, ruby,  tcl, labview, c++ with boost, .Net, PHP, Haskell etc). I've personally have only used * and ? on the command line and never in a programing language. Also the * and ? form is less expressive.

The icon not matching the function is messed up though.
Message 15 of 19
(1,148 Views)
I just remembered the * and ? form is called a glob
0 Kudos
Message 16 of 19
(1,144 Views)

Just came here for reeading. Smiley Very Happy

Nice knowledge base.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 17 of 19
(1,130 Views)

Can somebody explain more of wildcard search ?

I cannot understand fully. Smiley Sad

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 18 of 19
(1,128 Views)
@tbob: stick to windows conventions? It's much less powerful than the options offered by match pattern. Look at the alternates for example. There are limited special characters available (like *,?,+,...) and once you're familiar with the match pattern regular expression syntax it's really powerful. I wouldn't want to be limited to the windows wildcards * (any number of any character) or ? (any character).

btw, if you place the "Match Regular Expression" function on the block diagram it has nearly the same icon as match pattern, but with b+ instead of b*...
0 Kudos
Message 19 of 19
(1,124 Views)