I’m trying to insert a NULL between the first pair of commas in the line
below if it’s not already there.
Before: PWCLLP-243-00000002,Images\1\pwcllp_243_00000002.tif,
After: PWCLLP-243-00000002,NULL,Images\1\pwcllp_243_00000002.tif,
I want to replace only the first instance of , on the line with ,NULL,
I can do that with: @record.sub!(’,’,’,NULL,’)
The problem is if the record already has NULL between those 2 commas,
I’d get:
PWCLLP-243-00000002,NULL,Images\1\pwcllp_243_00000002.tif,NULL,
I tried this: @record.sub!(’[[:digit:]],’,’,NULL,’)
I figured that would replace the first instance of a digit followed by 2
commas, but it doesn’t work. I’m assuming my syntax is incorrect, but
I’ve tried all variations I can think of. Anyone out there have any
ideas? I’d be very grateful!
PV