December 14th, 2012, 12:58 PM
Simple regex help
I'm a newbie at regex and need some help with the following. I want to match ABC and anything with number + ABC so ABC, 1ABC, 2ABC, etc. would be valid but not match anything else such as ABCD, KABC, 2ABCD. ABC could be variable in length. This is what I've tried the re below but I don't think that's correct. Can someone pls help out?
December 14th, 2012, 01:35 PM
Try more like
1. The string starts with zero or more numbers
2. Followed by the letters "ABC"
3. Followed by the end of the string
December 14th, 2012, 01:40 PM
yes that is exactly what i want - i just wanted to elaborate on the edge cases that were eluding my RE. any advice for the actual RE?
December 15th, 2012, 04:48 AM
You are saying that your RE should not match "2ABCD", but, at the same time that ABC could be variable in length. That sounds as a contradiction to me, so I am afraid you are not being sufficiently precise about what your RE should match and what it should not match.
Comments on this post