Thread: C# regex help
View Single Post
Old 05-31-2009, 08:54 AM   #2 (permalink)
S0ULphIRE
S0ULphIRE's Avatar
 
01001100011011110110110

Join Date: Mar 2007

Location: Perth, Australia

Posts: 1,988

S0ULphIRE has a spectacular aura aboutS0ULphIRE has a spectacular aura about

Send a message via MSN to S0ULphIRE
Default Re: C# regex help

well I can answer some of that right now.
Remember that you've enclosed 0-9 in square brackets [ ]. That specifies to look for only one match. So it looks ONLY for ONE number in each octect, hence why you can slip in some letters too.

This is what I'm thinking right now:
Regex pattern = new Regex("\b[0-9]{2}.[0-9]{2}.[0-9]{2}.[0-9]{2}\b");

Bear in mind the last time I did Regex was like a year or two ago That might need a little tweaking, but it should set you on the right path.

nehuz, put it in and see what it does. The only part I'm not sure about is how your program will like the { }'s in the regex expression, but like I said it *should* work...
__________________
"As a result of all this hardship, dirt, thirst, and wombats, you would expect Australians to be a dour lot. Instead, they are genial, jolly, cheerful, and always willing to share a kind word with a stranger, unless they are an American."
-- Douglas Adams

Click this if I helped you
>>>><<<<

Last edited by S0ULphIRE; 05-31-2009 at 08:56 AM.
S0ULphIRE is offline