[PLUG] Emacs regex: quote dates

Galen Seitz galens at seitzassoc.com
Wed Nov 23 01:17:49 UTC 2011


Rich Shepard wrote:
>    I've looked at the emacs wiki regex page and tried a couple of different
> ways to put single quotes around dates in a large data file, but I've no
> succeeded. I'd appreciate some help here.
> 
>    The dates are in SQL INSERT INTO statements delineated with commas and of
> the ISO standard YYYY-MM-DD. I've tried the regex search-and-replace using
> [:digit:] and [0-9] for each digit in the dates but that's not doing the
> job; I get the search string inserted rather than the original date
> surrounded by single quotes.
> 
>    I'm far from a regex expert despite having read the ORA regex book a while
> ago and the emacs wiki just now. I don't use them enough to have become
> fluent.

What do your search and replace strings look like?  I'd expect
something like this.

search:  ,\(date_match_pattern\),
replace: ,'\1',

galen
-- 
Galen Seitz
galens at seitzassoc.com



More information about the PLUG mailing list