LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Match hex 00 or NULL with Match pattern function

Solved!
Go to solution

Hi, I am using Match pattern funciton to match NULL character and 0000 character in a string (hex display).

Someone told mu use the following regular expression:

^[\00]*, and [\00]*$ , and he said:

                \00 is Hex 00

                \0 un-defined

 

But I read some stuffs about regular  expression that \0x00 is Hex 00, \00 is Octal 000.I want to know what meaning the \00 is.

Please refer to the attached trim00.vi.

Download All
0 Kudos
Message 1 of 6
(6,184 Views)

Match Pattern and Match Regular Expression are two different functions. With Match Pattern the string ^[\00]* matches any number of null characters starting at the beginning of the string, while the string [\00]*$ matches any number of null characters starting at the end of the string. Check the help for the Match Pattern function for more info.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 6
(6,181 Views)

then [\00] maches NULL ? from ASCII, \x00 is NULL, but when I replaced \00 with \x00, the vi not worked well.

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

Any non-numeric character following the back slash is taken literally. This allows you to search for things like the backslash character (by using \\ as a search term - literal character "\").

 

A slash followed by a number \00 is interpreted as the ASCII representation of that number (in this case NULL).

 

Using \x00 will look for "x00" (the x is taken as a literal).

 

I hope this clears up a little confusion.

 

Rob

0 Kudos
Message 4 of 6
(6,172 Views)

But I searched <regular expression> entry in the Labview help file, <Special Characters for Match Regular Expression and Search and Replace String> page:

 

  • \031 - Matches an octal character (31 octal in this case)
  • \x3F - Matches a hexadecimal character (3F hexadecimal in this case)
0 Kudos
Message 5 of 6
(6,170 Views)
Solution
Accepted by concorpoly
Yes but as I stated earlier that is a different function from the one you are using.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 6
(6,168 Views)