How do I split an escaped string?
For example, I have a string where \ is the escape character.
So if the string is:
abc def\:ghf : xyz
and I split it by :,
I'd want to return the strings
"abc def\:ghf"and "xyz".
Not "abc def\", "ghf" and "xyz".
Thanks,
Enter
Arne Vajhøj - 04 Oct 2007 14:01 GMT
> How do I split an escaped string?
>
[quoted text clipped - 11 lines]
>
> Not "abc def\", "ghf" and "xyz".
String s = "abc def\\:ghf : xyz";
String[] parts = s.split("(?<!\\\\):");
seems to work.
Arne