Regex is matching quotes when I do not want it to -


here link demo http://www.regexplanet.com/cookbook/ahjzfnjlz2v4cgxhbmv0lwhyzhnydwssbljly2lwzrjrstamda/index.html

select java 1 , @ input. can supply arguments either within quotation marks or without. however, when regex captures groups, don't want capture quotes arguments enclosed within quotes. it's confusing because quotes out of brackets don't know why they're being captured.

how can fix this?

edit:

to clarify, want output this:

hello-world hi  \" \\ sparta 

if don't want double quotes caught need avoid matching them using zero-width assertions - lookarounds:

(?<=")(?!\s+")(?:[^\\"]+|\\")+(?=")|[^"\s]+ 

live demo


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -