RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Extract value range from text comment
Expression
(((?<numb1>[\d\.-]+)([\s]*?)(?<oper1>(\>=|\<=|=\>|=\<|\<|\>|=){1})([\s]*?)){0,1})(?<varname>(salary|mph|kph|ph){1})((([\s]*?)(?<oper2>(\>=|\<=|=\>|=\<|\<|\>|=){1})([\s]*?)(?<numb2>[\d\.-]+)){0,1})
Description
Extract a variable name and range from text containing expressions like: "car travelling 30 < mph < 80" or "acid solution pH < 3" or "net income 40000<salary<=60000" or "executive salary > 120000". Recognises comparisons before and or after the variable name. Tolerates white space between elements. Recognises =, <, <=, =<, >, >=, =< comparison symbols. LIMITATIONS: * Intended to extract information for a limited number of variable names from text that has not been diligently formatted. * Numeric value portions of the pattern could be refined. * Add/change variable names (mph, ph etc) to match your requirements. * When editing varname list put longer names first to avoid confusion between ph and mph (for example mph will be returned as ph if ph is listed first in the pattern).
Matches
30<mph<60 | 3<PH | pH < 3 | 40000<salary<=60000
Non-Matches
30<speed<60| ph 3 to 5 | salary over 120000| income>60000
Author Rating: The rating for this expression. chum bucket
   Displaying page 1 of 1 pages; Items 1 to 1

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials