[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] Reg exp for V.I.A.G.R.A
On Fri, Sep 12, 2003 at 08:57:11AM +0100, Chris Johnson wrote:
> Is there an easy way to write a reg exp to put in my mail filter that will
> take out all the viagras including those spaced with 0 or more other
> characters?
> v i a g r a
> v_I_a gra
> etc
/v[ _]?i[ _]?a[ _]?g[ _]?r[ _]?a/i
The /i bit at the end is for case-insensitivity. If your regex engine
doesn't supoort this, then use something like the following instead:
[vV][ _]?[iI][ _]?[aA][ _]?[gG][ _]?[rR][ _]?[aA]
The ? means match 0 or 1 times. Again, if that's not supported, you
may be able to use something like {0,1} instead.
--
The optimist believes that he lives in the best of all possible worlds.
As does the pessimist.
___________________________________________________________________
Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html
GNU the choice of a complete generation.