csvlint.io icon indicating copy to clipboard operation
csvlint.io copied to clipboard

Regex escaping

Open cgutteridge opened this issue 10 years ago • 1 comments

I can't tell if / should be escaped in pattern. I want to constrain a URL to an English-language wikipedia page:

    "constraints": {
            "type": "http://www.w3.org/2001/XMLSchema#anyURI",
            "required": false,
            "pattern": "https://en.wikipedia.org/wiki/.*"
    },

I can find out by trial and error, but because it's not encased in // it's not clear.

cgutteridge avatar Feb 24 '15 09:02 cgutteridge

Also, might be work mentioning that \ needs to be double escaped because of json so the above should have been more like
"pattern": "https://en.wikipedia.org/wiki/.*"

cgutteridge avatar Feb 24 '15 10:02 cgutteridge