csvlint.io
csvlint.io copied to clipboard
Regex constraints (in schema) not working
There are a few regex patterns in my schema, some more ambitious than others. I tested my regex at http://regexpal.com/ so it's DEFINITELY working (ha ha... anything tested on the internet is guaranteed to work!)
But anyhow, the Postal Code pattern is a lot easier to test and parse than the Hours pattern. The postal code pattern violations occur on lines 6 and 8 of column F. Hours violations at 3,4, 16, and 17 column J.
Here are my csv and schema respectively: https://drive.google.com/file/d/0B3CDKorSOdGNNm1CbXFrUmlFY1U/view?usp=sharing https://drive.google.com/file/d/0B3CDKorSOdGNN3JlZ2pDLWNKaXc/view?usp=sharing
The validator reports no errors or warnings on these data columns.

See comment on #183, there are some issues in the schema which means its not being applied.
I also tried the homepage regex at http://regexpal.com/, it also gives me an error (the asterisk is highlighted in red) using that service. I'd recommend Rubular though as its using ruby the same as csvlint.
Looks like the Postal Code pattern is working with a valid schema! Here's the schema: https://drive.google.com/file/d/0B3CDKorSOdGNd0ZMWDVZVlIwUTQ/view?usp=sharing
But the Hours pattern is not. Specifically, the problem cases that I inserted on lines 3, 4, 16, and 17 (column J) are not being flagged.
Rubular seems to be ok with my regex, which I admit may be dodgy.
Also, there doesn't seem to be a way to build a schema that does pattern-matching on Hours that ignores empty Hours fields. In other words, if you want to pattern-match on a field in your CSV, any record with null in that field will be flagged. I tried building one with a special case pattern that looks for nulls (https://drive.google.com/file/d/0B3CDKorSOdGNNU1sTjdqYkpmYlE/view?usp=sharing), but it then throws no errors on any of the Hours fields. Rubular is ok with this syntax but I admit I have no idea if CSVLint supports the eol/start-of-line business.