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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
(?=([\W]*[\w][\W]*\b))\s(?=\d\.|\d\b)
Description
This RegExp matches a space (" ") character with lookahead condition if there is an ASCII text in front of it and it is followed by a single decimal number which in turn is followed by a dot or nothing. It's useful to seperate scientific notation numbers from a text, i.e. when classifying with the bow toolkit. [EDIT 18.09.2004] There was indeed an error in the second lookahead. Changed |\b to |\d\b
Matches
ROOT 4.873624764e-34 | `1234567 890-= 3.8765e-34543 | ~! @ # $ % ^ & ( % )_+ 3.345e-2384754
Non-Matches
rstuvwxyz 754.234e-23 | yz754.234e-23 | yz .234e-23
Author Rating: The rating for this expression. Benjamin J. J. Voigt
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

Title: All right then - Changed the description
Name: Benjamin J. J. Voigt
Date: 8/5/2004 10:21:13 AM
Comment:
Of yes, of cause. Stupid me! I've changed the description of the pattern and will review it later on. Would etiquette require me to remove it?


Title: No, that's not correct...
Name: Darren Neimke
Date: 8/5/2004 8:08:22 AM
Comment:
If you look at the section of that tutorial titled: "Positive and Negative Lookbehind", you can see they clearly state: > The construct for positive lookbehind is (?<=text): > a pair of round brackets, with the opening bracket > followed by a question mark, "less than" symbol and an > equals sign. Negative lookbehind is written as > (?<!text), using an exclamation point instead of an > equals sign. Notice that they have a '<' sign in there! That's the difference between lookahead and lookbehind: lookahead: (?=...) lookbehind: (?<=...)


Title: Doesn't seem right
Name: Darren Neimke
Date: 8/4/2004 7:08:09 PM
Comment:
This pattern doesn't seem right for several reasons... You say - "character with lookahead/look behind condition" - but I don't see any lookbehind condition there. I can't even see why a pattern such as this would need Lookaround; surely Lookaround for something such as this would only *add* complexity? Why wouldn't a pattern such as: ^\b\w+\b[ ]\d+\.\d+(?:e\-\d+)? ...work? ** NOTE: Obviously, in my example pattern you would need to provide a fuller implementation of Decimal matching.


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