LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

match pattern

I have a string "hello" and "hellollo", and I want to find out either "llo" pattern or "llollo" pattern. But the regular express of (llo)+ doesn't work for me.  

Many thanks!

Download All
0 Kudos
Message 1 of 5
(2,085 Views)

I think it works if you change the () to [] brackets.

Message 2 of 5
(2,081 Views)

Match pattern uses a limited set of regular expressions terms.  Try Match Regular Expression

 

 EndigitBryan, the bracket will not match a pattern, but any of the letters in the set

e.g. 'l' in help, or 'oo' in hook

0 Kudos
Message 3 of 5
(2,055 Views)

@Mancho00 wrote:

 

 EndigitBryan, the bracket will not match a pattern, but any of the letters in the set

e.g. 'l' in help, or 'oo' in hook


You are right!  I should have thought about it longer.

0 Kudos
Message 4 of 5
(2,033 Views)

Of course "(llo)+" will also match "llollollo", "llollollollo", etc...

 

If you want to match only "llo" and "llollo", you'll need:

"(llo)|(llollo)", "(llo)()|(llo)", "(llo)(llo)?", "(llo){1,2}" or "(llo)\1?".

0 Kudos
Message 5 of 5
(2,005 Views)