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]+
Comments
Post a Comment