Forum Discussion

PerBonomi's avatar
5 years ago

RegEx to block an email and its variations

Hi folks, figure this might be a good place to ask.

Now, realizing nothing is 100% fool- or troll proof, I was wondering if anyone here ever experimented with regex to try and block as many variations of a certain email address as possible.

Thanks.

  • We block pretty much any email address then allow some through with negative lookahead.

    r:\b[\w.%+\-](?!buse)(?!iewerr)(?!kyboxofficesupport)(?!sername)(?!ccessories)(?!kysupport)(?!pps)(?!tvboxofficesupport)[\w.%+\-]+@[\w.\-](?!ky.uk)[\w.\-]+\.[A-Za-z]{2,6}(?!")(?!”)(?!.uk")(?!.uk”)\b

  • We block pretty much any email address then allow some through with negative lookahead.

    r:\b[\w.%+\-](?!buse)(?!iewerr)(?!kyboxofficesupport)(?!sername)(?!ccessories)(?!kysupport)(?!pps)(?!tvboxofficesupport)[\w.%+\-]+@[\w.\-](?!ky.uk)[\w.\-]+\.[A-Za-z]{2,6}(?!")(?!”)(?!.uk")(?!.uk”)\b

    • Malcolm-M's avatar
      Malcolm-M
      Boss

      Should add, there is a bit of repetition in there at the end due to having some problems allowing a specific bypass. 

  • Where are you using regex at? The user ban tool only supports ? and * as wildcards (as far as I know).