I start with entries like this in a spreadsheet:
Notice the different size dashes.. Longer one after Permit Date. Chr(8211) if I am correct.
I turn the spreadsheet into a query:
I get a cell value and regex that first bit out of it. (Regex pattern seems a bit much but it works)
//i make a new query and set one cell
querysetcell(newquery,"permitDateHeader",rereplace(cellWithPermitDate,
"^[(\W)]*(\w)*(\s)*(\w)*(\s)*(\w)*(:| -| –)+","","all"), insertRow);
However, I still am left with this:
Notice the regex worked on the Construction Type with just the two small dashes.
So I created a test page .cfm (this other stuff was running in a controller)
number = "Permit Number: 2016-1";
date = "- Permit Date – January 13, 2016";
reformednumber = rereplace(number,"^[(\W)]*(\w)*(\s)*(\w)*(\s)*(\w)*(:| -| –)+","","all");
reformeddate = rereplace(date,"^[(\W)]*(\w)*(\s)*(\w)*(\s)*(\w)*(:| -| –)+","","all");
writeDump(reformednumber);
writeDump(reformeddate);
And this is what is dumped:
Permit date was successfully parsed. This time on a .cfm page rather than in the controller and putting it in a query. That's the only difference I see. same regex.
Why is this happening?
Possible solution is just changing the regex. I just didn't want to pick up values that fall under the \W scope such as a dollar sign.
Note if this can't be recreated then it may be too 'application-specific' of an error to be left on the forum.
I am still not sure why that happened, but this edit to the regex seems to have fixed it.
^[(\W)]*(\w)*(\s)*(\w)*(\s)*(\w)*(\s)*(\W)?
//used(\W)? at the end rather than (:| -| –)+
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments