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.
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.
04-15-2009 03:48 AM
Solved! Go to Solution.
04-15-2009 04:36 AM
Hi ceties,
what do you need? Do you need "A1_" or "A1" or ...? Can you explain a bit more?
Mike
04-15-2009 04:50 AM
04-15-2009 04:52 AM
If there's always an underscore _ in front of the number you could search for _[0-9]+ or similar.
04-15-2009 04:55 AM
04-15-2009 05:03 AM
04-15-2009 09:22 AM - edited 04-15-2009 09:23 AM
ceties wrote:
This is the best solution I was able to come with. I am just wondering if there is "smoother way" without the cycle.
Since multiple checks are required I would tend to beieve that we do have to loop through the possibilities. in this example
I start check at offset "0" into the string for a number. Provided i find a number I check if it is longer that any previous number I found and if so save the new longer number in the shift register.
Have fun!
Ben
04-15-2009 09:31 AM
04-15-2009 10:26 AM
gsussman wrote:
Use "[0-9]*" as your regular expression input.
It will match the longest instance with no loop required.
One thing to note, it will see 1000.023453 as two seperate matches.
If you need to deal with floating point numbers, the iterative method seems to be the most robust.
Umm, nope. Did you test this? When you try it against the examples gived (S1_1000), you'll get an empty string, because your match says "0 or more digits" and the first thing that matches that is an empty string because the first character in the string isn't a digit. If you're seeing in the help a comment about longest match, or greedy matching, what that means is that if you feed it the string 1000, it will get all 4 characters, not just the first one, even though the first digit on its own (or even the empty string as demonstrated above) is a sufficient match.
04-15-2009 10:55 AM