help with regex wanted >.<

These are old archives. They are kept for historic purposes only.
Post Reply
ankitvani
Posts: 12
Joined: Wed Jan 31, 2007 5:58 pm

help with regex wanted >.<

Post 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 >.>
Jobe
Official supporter
Posts: 1180
Joined: Wed May 03, 2006 7:09 pm
Location: United Kingdom

Post 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"
ankitvani
Posts: 12
Joined: Wed Jan 31, 2007 5:58 pm

Post 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.
ankitvani
Posts: 12
Joined: Wed Jan 31, 2007 5:58 pm

Post 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
Jobe
Official supporter
Posts: 1180
Joined: Wed May 03, 2006 7:09 pm
Location: United Kingdom

Post by Jobe »

.? = 0 or 1 char instead of .* which is 0 or more
Post Reply