W
wingers
Guest
Hi, can someone help me amend this regex so that it also avoids adding duplicates, and meets other requirements:-
Regex
@[\""].+?[\""]|[^ ]+
Sample string
".doc" "test.xls", ".doc","me.pdf" .doc "my file.txt"
Would want it to return
".doc"
"test.xls"
"me.pdf"
"my file.txt"
Not
".doc"
"test.xls"
".doc"
"me.pdf"
".doc"
"my file.txt"
Note:
Filenames could potentially have spaces e.g. "test file.doc"
items could be separated by a space or a comma or both
strings could have quotes around or NOT have quotes around e.g. .doc ".doc"
-- OR ---
Another solution if RegEx is not best
Basically I will have a string in the format above which then needs splitting into an IEnumerable (Of String)
Darren Rose
Continue reading...
Regex
@[\""].+?[\""]|[^ ]+
Sample string
".doc" "test.xls", ".doc","me.pdf" .doc "my file.txt"
Would want it to return
".doc"
"test.xls"
"me.pdf"
"my file.txt"
Not
".doc"
"test.xls"
".doc"
"me.pdf"
".doc"
"my file.txt"
Note:
Filenames could potentially have spaces e.g. "test file.doc"
items could be separated by a space or a comma or both
strings could have quotes around or NOT have quotes around e.g. .doc ".doc"
-- OR ---
Another solution if RegEx is not best
Basically I will have a string in the format above which then needs splitting into an IEnumerable (Of String)
Darren Rose
Continue reading...