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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Fraction numbers
Expression
(?:-(?!0))?\d+(?:(?: \d+)?/\d+)?
Description
This regexp matches string which represents a fraction. This fraction can be in these forms:<br /> 1. # or -# (not -0)<br /> 2. #/# or -#/# (not -0/#)<br /> 3. # #/# or -# #/# (not -0 #/#)
Matches
-1, 1, -1/2, 1/2, -1 2/3, 1 2/3 | 0, 0/1, 1/0, 1 0/2, 1 2/0
Non-Matches
letters | negative zero | / | #/ | /# | # / | # #/ | # /#
Author Rating: The rating for this expression. Daniel Beck
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-2018, RegexAdvice.com | ASP.NET Tutorials