8
shouts

Lookbehind in Regex searches - Rick Strahl

posted by StevesSteves 163 days, 22 hours, 50 minutes ago
Tuesday, October 06, 2009 11:21:07 AM GMT

I’ve said it before – Regex is not one of my strengths and although I use Regex expression quite frequently in code I’m in fear (literally) of using longer Regex expressions, fully expecting to look at my own Regex code and not remember what it does10 minutes later :-}. Ok, not quite so bad, but not completely off the mark.

Today I had what is a fairly simple problem – I needed to match a JSON string and check for invalid quote characters in the string. For example:

JSON String: \"that has legal nested...

category: Foundation | clicked: 10 | | source: west-wind.com | show counter code
tags: JSON, Regex, Regular Expression