Link to home
Start Free TrialLog in
Avatar of tmajor99
tmajor99

asked on

Regular Expression to Extract Numbers and Fractions

I need a regular expression that will extract numbers and "/", ".".

Data Example:            Results:
----------------------           -----------
3.66                               3.66
1-1/34                           1-3/4
N/A                                [null]
Test 3.55                       3.55
5                                     5
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Maybe this...

\d+[\.-]?(\d+)?(\/\d+)?
Is it a typo that 1-1/34 becomes 1-3/4?
Subodh Tiwari (Neeraj);  your not catching the plain text record of "N/A"
by adding a NULL to your expression results.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial