Need expression to find mixed number in string.

I am looking for a regular expression pattern that will find mixed numbers as in below:

1 1/2
12 2/3
2 11/13

There is a white space between the whole number and fraction. This is to be used with VB.net code.
NevSoFlyAsked:
Who is Participating?
 
käµfm³d 👽Commented:
Put capturing parentheses around each component. Then replace with what was captured.

e.g.

Dim result As String = System.Text.RegularExpressions.Regex.Replace(source, "(\d+)\s*(\d+)\s*/\s*(\d+)", "$1:$2/$3")

Open in new window

0
 
MazdajaiCommented:
Try

(^\d{1,2}\s\d{1,2}\/\d{1,2}$)

Open in new window

0
 
NevSoFlyAuthor Commented:
Thanks for your help.  Unfortunately I for got to add that I was attempting to replace the white space in the string between the whole number and fraction with ":".

My apologies for such poor communication.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.