java - Extract string between characters -
i'd extract 2 arguments given string using regex. example:
c:\users "c:\program files"
c:\mytext.txt mytext2.txt
output c:\users , c:\program files
c:\mytext.txt , mytext2.txt
if string between " " can contain white spaces, otherwise has without them. far managed extract arguments between " ", can't figure out how extract them when 1 argument has " " , other 1 doesn't (like in example above).
pattern p = pattern.compile("\"(.*?)\""); matcher m = p.matcher(string); while(m.find()){ system.out.println(m.group(1)); }
Comments
Post a Comment