LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

match pattern bug with ranges of control characters

Solved!
Go to solution

The match pattern primitive has issues when dealing with ranges of control characters. For example I want to match any control character (0x00-0x1F) in the input string with the pattern [\00-\1F]. The match pattern primitive does not consider that pattern as a range but as three characters: \00, - (dash) and \1F. It will return a match only if one of these three characters is in the input string. It works correctly when using \codes for other ranges like [\30-\39] to match decimal digits.

 

LabVIEW 8.6

Message Edited by JeanPierre on 05-03-2010 02:49 PM


LabVIEW, C'est LabVIEW

0 Kudos
Message 1 of 7
(3,938 Views)

If I undestand you correctly, looking to match "0x0F" as an example.

Then try this string for the regular expression: 0x[0-9,A-F][0-9,A-F]

 

James

LabVIEW 5.0 seems so long ago...
0 Kudos
Message 2 of 7
(3,917 Views)
No. I want to match control characters in the hex range 0x00-0x1F, like linefeed and tab.
Message Edited by JeanPierre on 05-03-2010 03:27 PM


LabVIEW, C'est LabVIEW

0 Kudos
Message 3 of 7
(3,908 Views)
Solution
Accepted by topic author JeanPierre

OK, I obviously didn't pay close attention to your post.

Try using Match Regular Expression and then use [\x00-\x1F] for the regular expression input.

 

CtrlCharMatch.png 

 

I hope this is closer to understanding your problem than my first reply.

 

Regards,

 

James

LabVIEW 5.0 seems so long ago...
Message 4 of 7
(3,890 Views)
Kudos for the simple workaround but there is still a bug with Match Pattern...


LabVIEW, C'est LabVIEW

0 Kudos
Message 5 of 7
(3,885 Views)

Strictly speaking it is not a bug! The online help for the Match Pattern says:

 

[] Encloses alternates. For example, [abc] matches a, b, or c. The following character has special significance when used within the brackets in the following manner:

-(dash) Indicates a range when used between digits, or lowercase or uppercase letters; for example, [0-5], [a-g], or [L-Q].
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 6 of 7
(3,855 Views)

You are right (again) rolfk!

 

However there is no such (arbitrary, imho) range limitation in similar primitives like Scan From String (format %[\00-\1F] works as expected)and Match Regular Expression.



LabVIEW, C'est LabVIEW

0 Kudos
Message 7 of 7
(3,810 Views)