문제

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 ?

도움이 되었습니까?

해결책

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

다른 팁

You need to escape the dot: "\." - otherwise, the regex parser treats it as the reserved "any char" symbol.

-- EDIT -- Now that we know that the dot IS escaped and therefore not the real problem: Are you sure the space before the dot is intentional?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top