I'm having an issue with a Regex. I basically need to split a string with Chr(1) as a delimiter and each group is formatted as key=value (where key is numeric). The beginning of the string is a 3-char code and is not gathered with the Regex. Example:
031|0=2013/12/04 00:03:35|400=lr5ulz1jxg8ss|3=SFE|4=2$1NNR|6=1
So I used the following Regexp:
Private Shared _RegexDeserialize As New Regex(String.Format("{0}(\d+)=([^${0}]*)", Chr(1)))
But when there is a dollar ($) in the value part, the rest is not matched.
Then I used the following:
Private Shared _RegexDeserialize As New Regex(String.Format("{0}(\d+)=([^{0}]*)", Chr(1)))
I don't understand why my previous Regex doesn't work properly and why VB.Net is matching the end-of-string delimiter ($) to the dollar ($) of the string. If I wanted to match to a dollar, I should have escaped it: \$
Any help will be appreciated. Thanks very much.
If I wanted to match to a dollar, I should have escaped it: \$. Yes you answered yourself.^and-which take different meanings depending on their position in the character class.