-3

I'm trying to match e-mails with a string like:

s.te.e.ve.s.mit.h.p@gmail.com

Effectively I'm after any repeating pattern (of at least 4 times) of a string of characters followed by a period, with the last before the email domain not having a period.

I'm not great with Regex, but so far I've only come up with:

[aA-zZ\.]{4,}[aA-zZ]@.*

This matches what I need, however it also pulls more than I'd like.

Any advice?

Wiktor Stribiżew
  • 484,719
  • 26
  • 302
  • 397

1 Answers1

-1

Thanks for the help, I see now where I was making the mistake. Wiktor's answer seemed to work the best, though for some reason it would time out in Redshift if I didn't put . in brackets. [.]

The expression which appears to work correctly is:

^([a-zA-Z][.]){4,}[a-zA-Z]@.*

  • 1
    Correct. I was looking to match text separated by at least 4 periods, but not at the end. So there will be at least 5 groups of text separated by 4 periods. – Steve P Oct 27 '20 at 14:39