Posted By: DoomBringer | Sep 4th, 2007 @ 12:50 PM
page 1 of 1
Comments: 3 | Views: 1966
DoomBringer
DoomBringer
Doom!
Regular expressions have always been arcane scribblings to me -- random characters thrown together that perform magic and are inherently incomprehensible.  At least, to me, that is.

Anyhow, I'm working on learning them, and I was running into some interesting things.

First, I want to write a regex that will match if the inputted string has the same character in it three times in a row.  So, "aaa" will match, but "aata" shouldn't.  I first came up with .{3,}, but that matches anything with length of three or higher.

Another trick I want to do is to match if the characters contained in the string are sequential.  For example, "Test" wouldn't hit, but "abc" would, as would "123".

I'm a complete regex noob.  I've read some tutorials and downloaded the regulator, but I'm still confused over this.
Matthew van Eerde
Matthew van Eerde
AKA Maurits
Something like (.)\1\1 should do the trick for the "aaa" case.

I don't think it's possible to match "abc", "def", "(x)(x+1)(x+2)" with regular expressions.
page 1 of 1
Comments: 3 | Views: 1966
Microsoft Communities