0

I want to have a regex match alphabets with its minimum at abc.

So I want to detect if the string contains the alphabet (abcdefghijk...) with case insensitivity.

So it could match :

abc
AbC
abcde
ABCDE
abCdefG

But not match :

cdef  -- missing the a
abd   -- missing the c

How could i do this?

LukStorms
  • 28,916
  • 5
  • 31
  • 45
Mininny
  • 85
  • 6
  • 1
    Please label with the regex tool/language you are using. – Tim Biegeleisen Aug 14 '17 at 13:31
  • With `proceeding alphabets` do you mean that `abcdez` should not match because of the `z`? – Fabrizio Aug 14 '17 at 13:46
  • For "a" to "g" in javascript: `/\ba(?=b|\b)b?(?=c|\b)c?(?=d|\b)d?(?=e|\b)e?(?=f|\b)f?(?=g|\b)g?(?=h|\b)\b/gi`. But if you would extend that for the whole alphabet it becomes a monstrosity of a regex. A simple loop in your programming language to check each character of a string that matches `/^a[b-z]+$/i`could turn out to be a better golf. – LukStorms Aug 16 '17 at 08:44

0 Answers0