regex - Java Regular Expression - Characters "(" and ")"Matches the Pattern "[\\p{Alpha} '-,.]" -
i have been wondering why characters "(" , ")" matches pattern "[\\p{alpha} '-,.]". please take @ code. method matches homecoming true characters "(" , ")". also, there other characters homecoming true if tried match pattern?
import java.util.regex.pattern; public class main { public static void main(string[] args) { string pattern = "[\\p{alpha} '-,.]"; //string text = "("; string text = ")"; system.out.print(pattern.matches(pattern, text)); } }
this because '-, interpeted range , equivalent '()*+,, seek escape minus character "[\\p{alpha} '\\-,.]"
java regex pattern-matching match
No comments:
Post a Comment