regex - regexp: FirstName.LastName or FirstName.Letter.LastName -


I want to make a regular expression, but unfortunately my thoughts do not work. Regular expressions should only allow entry A string consisting of parts:

Part one: letter (az) and dot

part two: only one letter and dot (this part is not required but tolerant)

Part two: Dot and letters (az)

Valid example:

  • john.shmith
  • john.a.smith
  • harry.x.doe
  • test.y.acme

E matches Example:

  • John. Smith
  • John Smith
  • John. Esith
  • John. X.Smith
  • John.y.smith
  • Jen.Ismith.
  • Mary-Kate.
  • A potential solution:

      ^ [ Az] + \. ([Az] \.)? [Az] + $  

    In more detail:

      ^ ---> Match starts [a-z] + \. --- & gt; The first part (the letters [a-z] and one dot) ([a-z] \.)? --- & gt; Optional part (only one letter and one point) [a-z] + --- & gt; Second part (letter [a-z]) $ --- & gt; Match end  

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -