Should it match the 33.33 in 133.33?
–
Jeremy SteinJun 18 '09 at 18:19

No, there is no match if there are more than two digits before or after the decmial point. I think this is where I was confusing people.
–
ErixJun 18 '09 at 18:21

3

A seriously good investment if you have more questions like this would be to get RegexBuddy. Incredible piece of software that lets you write/test regular expressions on the fly.
–
BrianJun 18 '09 at 18:38

This is how I would do it, except, use \d{0,2} or [0-9]{0,2} to match the given example .33
–
Daniel VandersluisJun 18 '09 at 18:17

2

Which doesn't get .33. Try changing the first to \d{0,2}.
–
David ThornleyJun 18 '09 at 18:17

1

You also need to anchor the expression to satisfy the "and NOT match anything with more than 2 digits before or after the decmial point." requirement.
–
Daniel VandersluisJun 18 '09 at 18:20

1

In order to anchor it properly, I need to know whether to anchor on whitespace or beginning/end of line or whatever. Information I don't have, so I'll leave that as an exercise for the student.
–
LeeJun 18 '09 at 18:22

This worked perfectly. Thank you all for your help!
–
ErixJun 18 '09 at 18:26

"\d{1,2}$" matches a 1-2 digit number with nothing after it (3,33,etc), "(\d{0,2}.)?" matches optionally a number 0-2 digits long followed by a period (3., 44., ., etc). Put them together and you've got your regex.