LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing out non-numeric characters in a string

Solved!
Go to solution

Ok thanks for the help Bill, Kudos coming your way soon!

 

Anyone else have any ideas to help me with my RegEx or Search and Replace Pattern problem (see previous posts for problem)?

 

Thanks for any help!

SM

0 Kudos
Message 61 of 70
(1,880 Views)

Search and Replace Pattern.vi

 

undefined

 

Ben64

Message 62 of 70
(1,876 Views)

Ben,

Thanks for the reply. I have LV 2013 though... Is there a way you can make that 2013 compatible?

Thanks,

SM

0 Kudos
Message 63 of 70
(1,874 Views)

Ben,

 

Thanks for the reply, works brilliantly.

 

First, I tried to repeat that same process to eliminate multiple decimal places (see attached), and it didn't really work.

 

Second, can you kind of explain to me the syntax for that? For instance, was does the "+" mean in the search section. For example the one with the negative sign, does the "-+" in the search portion, does it mean it's looking for more than one "-" sign?

 

Thanks,

SM

0 Kudos
Message 64 of 70
(1,853 Views)

@Sman29 wrote:

Ben,

 

Thanks for the reply, works brilliantly.

 

First, I tried to repeat that same process to eliminate multiple decimal places (see attached), and it didn't really work.

 

Second, can you kind of explain to me the syntax for that? For instance, was does the "+" mean in the search section. For example the one with the negative sign, does the "-+" in the search portion, does it mean it's looking for more than one "-" sign?

 

Thanks,

SM


Yes, in a regex the "+" means one or more consecutive occurence, for a litteral + sign you need to add an escape character: \+ (\++ thus mean or or more plus sign).

 

Ben64

0 Kudos
Message 65 of 70
(1,849 Views)

Ben,

 

Ok, that makes sense. Do you know why the "." section won't work correctly? Please see attached screen shot. Also, is there a way to combine all those Search Patterns so I don't have to have so many?

 

And is there a way to check for additional tilde's outside the brackets? Or a non-tilde character?

 

Thanks for the help,

SM

0 Kudos
Message 66 of 70
(1,846 Views)

Ok I got the decimal place working, I had to do the "\." Still though, is there a way to combine the searches so I don't have so many? Also, is there a way to check for additional tilde's outside the brackets? Or a non-tilde character?

 

Thanks for the help,

SM

0 Kudos
Message 67 of 70
(1,843 Views)

The . is a special character that matches any character, use \.

0 Kudos
Message 68 of 70
(1,838 Views)

Gotcha. Is there a way to look for multiple tilde's outside the brackets, or non-tilde characters outside the brackets?


Thanks,

SM

0 Kudos
Message 69 of 70
(1,830 Views)
Solution
Accepted by topic author Sman29

I figured out the non-tilde's outside the brackets, just did [~~] and that matches any non tilde character. Attached is a screenshot of my parsing code as of now.

 

Is there any way at all to check the pattern and notice that if a bracket is missing, it will automatically place a bracket there?

 

EDIT:

Also, is there a way to make a non-numeric entry a 0? For example, if I input: "[100~BadCharacter~300]" the output would be: "[100~0~300]". Right now if I do this the output looks like this: "[100~~300]". I can't really just say replace with a 0 because if I input: "[100~Bad123Charac123ter~300]" the output would be: "[100~000123000000123000~300]" and that is just a huge number. Can I check if there is like a string only with no numbers in between?


Thanks,

SM

0 Kudos
Message 70 of 70
(1,826 Views)