LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

strings and numbers

How can I seperate out or filter out some numbers from a alphanumeric string?

For eg:

if it is bslbfvbsh1.345

I want the bslbfvbsh in one indicator and 1.345 in the other indicator.

I have used the search/split string function but there you have to give the offset.

If there are thousand characters I don't want to count the number of characters in order to give the index.

Is there a way by which it can on its own filter out the string and numbers in different indicators?

0 Kudos
Message 1 of 6
(3,129 Views)

Hello Sunny,

 

use the Match Pattern Node, there you can feed as search pattern "[0-9\.]+", then you get the numbers with period in the [Match substring]- output, the part before will be given back in the [before substring]- output.

 

 

Greets, Dave
Message 2 of 6
(3,120 Views)

Example_VI.png

 

Your string resembled something I had read about in my youth.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 3 of 6
(3,106 Views)

@jcarmody wrote:

Example_VI.png

 

Your string resembled something I had read about in my youth.




Ah, regular expressions, you just have to love them. One note about th eabove regular expression is that it will match thing like 1....3 or ..2.5 and various other combinations. If your data could have such values you may want to change the regular expression to find exact valid numbers only. You could do this using "\d+\.\d+". You could refine it further if you may get a number such as ".123" in which case your regular expression could be "\.{0,1}\d+\.\d+".

 

Note: there are periods in my regular expressions preceeded by a '\'. The periods sort of get lost on the display depending on the resolution of your screen.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 6
(3,076 Views)
Message 5 of 6
(3,048 Views)

dave TW, jcarmody, Mark Yedinak, Darin K.

Thanks a lot!!Smiley Happy

0 Kudos
Message 6 of 6
(3,024 Views)