LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Match Pattern not wrking with character "["

Hello,
i have an input text where i want to do a pattern match for charcter "[", but this character is ignored and i get the full input text.
But the character "]" is working.
What do i have to do to make it work?
Thx

See attached vi for example of my problem.
0 Kudos
Message 1 of 8
(3,589 Views)
The "[" character is used as a separator in the syntax of the Match Pattern function.
Replace it with a \[ in the Regular Expression field. (Have a look at the online Help, and click Detailled Help)
Chilly Charly    (aka CC)
Message 2 of 8
(3,583 Views)
Hi chilly,
thanks for your help. This works.

But what happens if i want to search for pattern "\[" in the input string?

Input: Start \[Info] End
regular expression: \[




0 Kudos
Message 3 of 8
(3,565 Views)


OnlyOne wrote:

But what happens if i want to search for pattern "\[" in the input string?

\ is also a special character, so you need to escape it as well. The expression should be \\\[

___________________
Try to take over the world!
Message 4 of 8
(3,554 Views)


OnlyOne a écrit:
But what happens if i want to search for pattern "\[" in the input string?

Input: Start \[Info] End
regular expression: \[

The basic idea is to put an antislash "\" before any character used as a syntax symbol.
 
Accordingly, to  search for " \[", use "\\\[ "
BTW, this is also valid for the ] character !
 
Chilly Charly    (aka CC)
Message 5 of 8
(3,552 Views)
>BTW, this is also valid for the ] character !

But the ] character is working in my example (first posting) without the \.
0 Kudos
Message 6 of 8
(3,508 Views)

When I had this problem I used Ascii hex codes.  But it is good to find other ways, especially when they are easier.

\5C = \

\5B = [

\5D = ]



Message Edited by _Bryan on 11-08-2007 01:11 PM
0 Kudos
Message 7 of 8
(3,492 Views)

 

OnlyOne a écrit: ... But the ] character is working in my example (first posting) without the \.


I know. This is because the ] char is a closing symbol, and LabVIEW is smart enough not to properly interpret the search string. But it shouldn't harm you be rigorous 😉
Chilly Charly    (aka CC)
0 Kudos
Message 8 of 8
(3,462 Views)