regex - java regular expression for String surrounded by "" -


i have:

string s=" \"son of god\"\"cried out\" day , ok "; 

this shown on screen as:

"son of god""cried out" day , ok   pattern phrasepattern=pattern.compile("(\".*?\")"); matcher m=phrasepattern.matcher(s); 

i want phrases surrounded "" , add them arraylist<string>. might have more 2 such phrases. how can each phrase , put arraylist?

with matcher you're 90% of way there. need #find method.

arraylist<string> list = new arraylist<>(); while(m.find()) {     list.add(m.group()); } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -