Here's one for splitting the markets from GetAllMarkets api:
(?<!\):
or
"(?<!\\):" if you want it in java.
(?<!\) is a lookback to not split based on \:
permalink
the web page removed half the slashes
so once more:
(?<!\\):
"(?<!\\\\):" if you want it in java.
permalink
permalink
ahh... called my bluff. Can't say I'm any kind of regex expert. I know they are useful and can be a very fast way of parsing strings. I generally arrive at the right combination of squiggles more through trial and error than any kind of intelligent design.
This one is made of two parts. The requirement is to split the markets string on the ":" character, except where it has been prefixed with a backslash indicating it has been escaped. You find this sometimes in times or other uses of the ":". So the part in brackets is (with enough slashes to convince the java compiler) known as a "Zero-width negative lookbehind", for a single backslash in this case. This ensures a match is only made if the ":" doesn't have a slash before it. See http://www.regular-expressions.info/refadv.html for a more accurate description.
permalink
It's been a while since this topic was active, if you'd like to get it going again, please post as a registered member