On Tue, Nov 22, 2011 at 4:56 PM, Rich Shepard <[email protected]> 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.
I believe you want something like: M-x replace-regexp query = \([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\) replace = '\1' Note that you may want to add context to that, and there is *certainly* a shorter way to express four digits in a row... Don't forget to put the point at the top of the file first. --Rogan > > Pointers appreciated, > > Rich > _______________________________________________ > PLUG mailing list > [email protected] > http://lists.pdxlinux.org/mailman/listinfo/plug > _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
