Page 1 of 1
help with regex wanted >.<
Posted: Tue May 01, 2007 9:51 am
by ankitvani
what would be a regex that would match
this
t h i s
t32h34i234s
tdkndhklsajdilkasds
t &h$i __-s
"this" is what im supposed to spamfilter >.>
Posted: Tue May 01, 2007 11:46 am
by Jobe
t.*h.*i.*s
But be warned that will also match a hell of a lot of valid sentences like the following since .* will match 0 or more of ANYTHING:
The quick brown fox jumps over the lazy dog.
In that example the first .* will match nothing, the second .* will match "e qu" and the third .* will match "ck brown fox jump"
Posted: Tue May 01, 2007 12:15 pm
by ankitvani
thanks ^^.
and the word i want to spamfilter is more than 10 letters long, so that thing which you is said would be pretty rare lol.
Posted: Tue May 01, 2007 2:24 pm
by ankitvani
id also like to know of a regex for
t'h'i's't'h'i'n'g
where ' is a single character or no character.
so it would match
t h i s t h i n g
this thing
thisthing
Posted: Tue May 01, 2007 3:52 pm
by Jobe
.? = 0 or 1 char instead of .* which is 0 or more