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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find 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
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

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