regex - regular expression in java compile -


this regular expression, use on command line, when put same expressing on java pattern.compile, giving error

this regex /,.*"(.*)",\[6]/

this how trying in java

pattern p = pattern.compile("/,.*"(.*)",\[6]/"); 

but in eclipse showing error, 1 on this.

you have escape double quotes (and possibly blackslash) using backslashes.

edit:

it seems want this

,.*\"(.+)\",\\[6\\] 

you don't have include forward slashes in patterns in java. if know have between quotes, use + instead of *, , have escape square brackets, because want literal match.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -