LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in Match Pattern in LabVIEW 2010

I seem to have found a bug in MatchPattern in LabVIEW 2010 when upgrading code from LabVIEW 8.2.1. Please refer to attached snippet to see more of the details.

 

With an input string of "RDB\tE\n..." and a search pattern of "[^\r\n]+" I would expet the result to be "RDB\tE" but it really is simply "RDB". This is quite a serious bug as it can render many string syntax parsers invalid. Of course PCRE is a workaround for now, but the help of the PCR function says explicitedly that it is slower in performance than the Match Pattern function.

 

Windows XP SP3, LabVIEW 2010 SP1

Rolf Kalbermatter
My Blog
Message 1 of 6
(3,635 Views)

Correct me if I am wrong, but I believe the [^] construct in Match Pattern returns displayable characters, of which \t is not.

 

My opinion is annoying, but not a bug in LV10.  Certainly going to bite someone in the arse.  Particularly nasty that it worked (incorectly) in LV8.2 apparently, I hate bug "fixes" that fix bugs you had no idea existed. 

 

Personally, I have bitten the bullet and use PCRE almost exclusively.

 

I agree there is a bug here, a LV8.2 bug.

0 Kudos
Message 2 of 6
(3,560 Views)

By the way the [~] construct also returns non-displayable characters, this is what you should be using here.

 

Half of the time I foul up my PCRE regexes by screwing up the ^ and ~, one reason I am starting to stick to one.

 

 

0 Kudos
Message 3 of 6
(3,551 Views)

Match Pattern is Regex similar but not the same. This is what the online help in LabVIEW 7.1 had to say about the ^ character when in brackets:

 

^ Matches any displayable character, including the space and tab characters, except the characters or range of characters enclosed in the brackets. For example, [^0-9] matches all displayable characters, including the space and tab characters, except 0 through 9.

 

Emphasis is mine.

 

So I still believe it is a bug in 2010! Smiley Very Happy

 

 


Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 6
(3,541 Views)

LV9 Help for ^ inside []:

 

Matches any displayable character, including the space character, except the characters or range of characters enclosed in the brackets. For example, [^0-9] matches all displayable characters, including the space character, except 0 through 9.

 

Lack of emphasis shows lack of 'tab'.

 

I agree that it is devious to change behavior, but it is hard to say bug when the behavior matches the documentation.  That is usually all I ask.

 

 

 

 

0 Kudos
Message 5 of 6
(3,536 Views)

Yes I just checked. Seems the documentation was changed in LabVIEW 8.2 and then the functionality was changed to match the documentation in 8.5. And devious it is for sure!! Smiley Wink

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 6
(3,527 Views)