I need a regular expression which should parse string with white space and if white space exists in a string which ended with quotes (single/double) then it should not parse.
abc cde 'efg hij'k lmn'opq rst' 'ijk lmn' u'v'w xyz 'abc' \'\\\\\' \'_Notes.txt\'
Requirement O/P:
abc
cde
'efg hij'k
lmn'opq rst'
'ijk lmn'
u'v'w
xyz
'abc'
\'\\\\\'
\'_Notes.txt\'
I used below pattern for my requirement but this parsing like below
Pattern p = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'");
O/P:
abc
cde
'efg hij' //here k is missing
lmn'opq
rst'
'ijk lmn'
u'v'w
xyz
'abc'
'\\' //here original string is \'\\\\\'
'_Notes.txt' //here origina string \'_Notes.txt\'