07-01-2015 07:45 PM
A sometimes overlooked feature of Match Regular Expression is that you can resize and index the capture groups.
Use .*? for a lazy match...
07-01-2015 07:53 PM
As posted by PhillipBrooks,
you can use Match Regular Expression with the following pattern: .*? to use non-greedy matching (also you can use .+? and {2,5}? ).
Online help: http://zone.ni.com/reference/en-XX/help/371361L-01/lvhowto/regular_expression_patterns/
07-02-2015 07:32 AM
@PhillipBrooks wrote:
A sometimes overlooked feature of Match Regular Expression is that you can resize and index the capture groups.
Use .*? for a lazy match...
Philip, if you don't put ab in a capture group you only need to expand the output for (.*?).
To remove the empty spaces before cd and after ef the following regex can be used: ab\s*(.*?)\s*ab (or use TrimWhitespace.vi at the output).
If you want to capture all sequences between ab pairs you need to use a lookahead (the second ab pair will not be part of the match), If we have the following sequence: uv tk ab cd ef ab gh jk ab lm op ab
Your regex will match cd ef and lm op ignoring gh jk
Using the following regex ab(.*?)(?=ab) you will match all sub-sequences between ab pairs
Ben64
Ben64
07-02-2015 09:48 AM
Suddenly the code is about as complex as my version using "scan strings for tokens" above... 😄
07-02-2015 11:21 AM
With a known delimiter I would probably lean Spreadsheet string to array. That said:
07-02-2015 02:39 PM
@Darin.K wrote:
That said:
I knew that Dr. Regex would come up with a very long line of gibberish that does exaclty what the OP wanted. 😄
07-09-2015 03:12 PM
Someday, if i should happen to have a massive aneurysm at my desk, and so, exit this world for the next, I can guarantee that there will be unfinished regex code on a block diagram on my monitor.
07-13-2015 09:29 AM
@DavidBoyd wrote:
Someday, if i should happen to have a massive aneurysm at my desk, and so, exit this world for the next, I can guarantee that there will be unfinished regex code on a block diagram on my monitor.
All regular expressions by definition are unfinished and subject to improvement or simplification.