gdellaiera Posted January 10, 2018 Posted January 10, 2018 Does anyone know the best way to check for a character? I'm looking for an apostrophe ( ' ) at the beginning of a variable (years attended) that are being input by csv. In single record they get typed in '12-'15 but when uploaded in batch, excel will sometimes remove the initial apostrophe (due to it being a command in the software). I'd like the rule to check for the apostrophe and return the variable if there is one and return ' + variable if there isn't. I am thinking that this would have to be an OnRecordStart rule, but other than that I am a little lost. Thanks for any and all help! Quote
step Posted January 11, 2018 Posted January 11, 2018 You could do this: return Field("Years Attended").replace(/'(\d{2})/g, "'$1") Quote
ThePorge Posted April 18, 2018 Posted April 18, 2018 I would think your grep would be /'?(\d{2})/g What you have won't find the first two digit string if the leading apostrophe is not there. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.