Search code examples
javaregexjflex

Regex for name problem


I need regex for recognizing names which can be [a-zA-Z_] then . (dot) then again [a-zA-Z_]. I ([a-zA-Z_]+) \.([a-zA-Z_]*) but it doesn't work. Help ? Can anybody give me hoe to do that in JFlex ?


Solution

  • changing regexp by escaping dot and removing space.

    ([a-zA-Z_]+)\.([a-zA-Z_]*)

    additional suggestion to drop () and use temporary identifiers

    edit: increasing reputation by commenting regexp