This thread is very similar to what I want: A regular expression to be separated by spaces, if only in quotation marks
But I need a few additional rules that I canβt understand: - the above thread is divided into spaces if they are not in double quotes. However, it also breaks down into punctuation. I need something inside double quotes to stay as one entity.
For example:
/ Update setting0 value = "new value" / Save should return
/ Update
setting0
Value =
new value (I donβt care if it disables quotes or not)
/ Save
/ Import "C: \ path \ file.xml" "C: \ path_2 \ file_2.xml" / The output should return / Import
C: \ path \ file.xml (I don't care if it disables quotes or not)
C: \ path_2 \ file_2.xml
/ Exit
I ended up using this expression from the stream above:
(?<=")\w[\w\s]*(?=")|\w+|"[\w\s]*"
Can someone please help me set it up? Thank!
source
share