This widget could not be displayed.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan from string does not find number

Solved!
Go to solution

For the original poster, you could expand the regex to include all floting point numbers by searching for regex [+-]?\d+[.]?\d*+(?:[eE][+-]?\d+)


This regex can be simplified to [Ee+-\d.]+

 



The original RegEx of Stephen's is actually fairly common, and is meant to *only* match floating point numbers with or without the exponential notation.  The simplified version will match a lot of patterns that are not properly formed floating point numbers (E+e12+E-2ee).   Depends on how well you know the form of the input, and how much you trust it.

0 Kudos
Message 11 of 14
(1,333 Views)

I agree, I assume the  numbers were well formed.

 

Ben64

0 Kudos
Message 12 of 14
(1,330 Views)

I took a closer look at this regex [+-]?\d+[.]?\d*+(?:[eE][+-]?\d+)

 

Is there a purpose to the + between \d* and the non-capturing group? I think the non-cpaturing group should be optional if we want to match a number that doesn't have an exponent.

 

Ben64

0 Kudos
Message 13 of 14
(1,325 Views)

In cleaning up the quote the final ? was chopped off of the regex so the non-capture group is optional.  I agree, no need for a greedy quantifier beforehand, no harm though.

0 Kudos
Message 14 of 14
(1,320 Views)