regex - Regular expression illegal character in Java -
i've been looking through internet after big headache, cannon't find why regular expression wrong:
"\"\w*&&[\p{punct}]\"["+sepchar+"]\"\w*&&[\p{punct}]\""
i'm trying read master data file following pattern (quotes included):
"textvalue":"textvalue":"textvalue"
and split each line regular expression above.
so, example:
"hello:john":"hello:world":"hello:mark"
will splitted into:
{"hello:john", "hello:world", "hello:mark"}
the backwards slash escape character in java. need use 2 backslashes \\
include single backslash in regex.
try:
"\"\\w*&&[\\p{punct}]\"["+sepchar+"]\"\\w*&&[\\p{punct}]\""
Comments
Post a Comment