LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing out non-numeric characters in a string

Solved!
Go to solution

I just think it would save everyone tremendous headaches if you could develop a tiny data input app like I had constructed.  Much easier than flagging possible errors and correcting them.  (HINT: Put the main cluster in an array.)

 

Well, the other method has merit, too because you can cut and paste and change what you need to change.  Potentially easier to enter raw data.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 31 of 70
(2,121 Views)

regex.png

regex.png

This'll result in an empty string if the input doesn't match the pattern you've defined.  (Where's Rube?)

I've used the Format Into String node to make it easier to edit the core regex.

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 32 of 70
(2,114 Views)

Ben,

 

Thanks for the reply. The result is close to my needed result, but not quite there yet. Still needs a little more work.

 

There are a few things that didn't come out correctly. I built it exactly as you built yours, and I checked it 3 times. Attached is a screenshot of the input string and the resulting string. As you can see, the elements are kind of out of order, as well as missing the negative sign on the -150. What did I need to do to fix those things?


Thanks for the help!

SM

0 Kudos
Message 33 of 70
(2,104 Views)

@SteMob wrote:

 As you can see, the elements are kind of out of order. What did I need to do to fix that?


Thanks for the help!

SM


Well, the first thing you need to do is to show the code you used, posting the actual vi instead of a picture will be even more helpfull.

 

Ben64

0 Kudos
Message 34 of 70
(2,096 Views)

Ben,

 

I can't post the actual VI. Attached is a screenshot of the code. Should be exactly like yours. The String IN is the string from the previous post.


Thanks,

SM

0 Kudos
Message 35 of 70
(2,094 Views)

Nothing attached

0 Kudos
Message 36 of 70
(2,091 Views)

Sorry, please see attached.

 

Thanks,

SM

0 Kudos
Message 37 of 70
(2,088 Views)

Two parenthesis are missing in the regex of the first Match Regular Expression function.

 

Ben64

0 Kudos
Message 38 of 70
(2,070 Views)

Ben,

 

I see now. I fixed it, and it did indeed fix the order of the elements and such.

 

However, it still did not parse out the bad character. Attached is a screenshot of the results. Code is the same as last post, except with the missing parenthesis fixed. The input string has numbers and bad characters in it, but the resulting string just has 0's. How can I fix that, or did I mess up somewhere else?


Thanks for the help!

SM

0 Kudos
Message 39 of 70
(2,065 Views)

Ben,

 

I tried it with the attached bad character, and it worked great. However, although there was no bad character in the first portion of data (position data from post #1), the result was still 0's for all 3 elements?

 

thanks!!!

SM

0 Kudos
Message 40 of 70
(2,056 Views)