csvlint.io
csvlint.io copied to clipboard
Regex escaping
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.
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/.*"