PDA

View Full Version : Regular Expressions in c#


deicist
1 Sep 2007, 11:10am
Hi all, I'm trying to teach myself regular expressions in C# but I've run into a problem. I'm trying to match any occurence of V(number) in a string, then remove v(number) from the string, then match the last occurence of (number) in the remaining string. I can do the first 2 bits no problem, by matching 'V[0-9]*' but when I try to match [0-9]* in the string it won't work...unless the number is right at the start of the string. for example:

blahblah67blah doesn't match
67blahblahblah does match

Any ideas? (sorry if none of that made sense, I can post source code of what I'm doing if required)

BLuKnight
2 Sep 2007, 7:46am
Hmm... I've never done regular expressions in C# before. Post the code and lets have a look.

MiracleManS
2 Sep 2007, 12:06pm
I see what you're trying to do here. I had to do something similar not too long ago. If I can't figure this out, I know someone who can (and faster than I, in any case).