From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Alternative strings in Match Pattern function

I want to extract from a string the string that lays after two possible patterns. They are the string "CLOCK" and its lower case string "clock". I use the Match Pattern function enclosing the two alternatives between brackets (as shown in the Function & VI Reference Manual, chapter 6). But it doesn't work. Is that because I use the 4.0 version? Otherwise, how could I do this?
0 Kudos
Message 1 of 5
(2,655 Views)
You have to use the "regular expression" input string as
[Cc][Ll][Oo][Cc][Kk]
and in "after substring" you will get the result of extracting.
For example
CLOCK900 -> 900
clock900 -> 900
ClOcK900 -> 900
cLoCk900 -> 900
and so on.
I've checked it with my LV6 and it works fine.

Good luck.

Oleg Chutko.
0 Kudos
Message 2 of 5
(2,655 Views)
Thanks,

I've used that same expression on my example. I thought it would work, but it doesn't.
I think it may be a matter of the version I use (4.0) is much old for this.

How could I do something that works like that?
Maybe using the function twice?
0 Kudos
Message 3 of 5
(2,655 Views)
"AndresMenacho" wrote in message
news:506500000005000000345A0000-1011517314000@exchange.ni.com...
> Thanks,
>
> I've used that same expression on my example. I thought it would work,
> but it doesn't.
> I think it may be a matter of the version I use (4.0) is much old for
> this.

Convert the string to lower case and then search for the pattern? Upper and
lower case conversions have been there for a long time.

--
Craig Graham
Physicist/Labview Programmer
Lancaster University, UK
0 Kudos
Message 4 of 5
(2,655 Views)
Yes,

that is what I did instead of the first option reported.
Also I realized that I had written incorrectly the expression "[Cc][Ll][...". So that option works fine too.

Thanks to the two of you, after all.
0 Kudos
Message 5 of 5
(2,655 Views)