lucy24 - 6:10 pm on Sep 11, 2011 (gmt 0)
Urk. For starters, it helps if you say what language you're in. Is this a php/bb forum?
I started out here:
and eventually printed out a couple of sections after about the nineteenth time I had to consult the list.
The most obvious error-- this is a RegEx universal-- is that you have confused ? with *. Question mark means "maybe one, maybe none". Asterisk means "none or some".
You also need to know whether IMG is always capitalized, or whether it might also occur in lower case. This is dialect-specific.
In general it is not a good idea to have .* anywhere but the end of a pattern. Here you can constrain it much more narrowly by, say,
again dealing with the upper/lower case issue. The part you capture and reuse is $2. If all your unwanted domains happen to be dot coms, you can leave them out of the capture:
and put the .com in your replacement string instead.
Incidentally, why do you want to do this? In general, unwanted hotlinking is considered the originating site's problem. And you can't possibly list every x-rated domain in the world.