Emacs regex: add quote in middle of line -
i'm trying build sql statement, need have varchar fields quoted, of course. far emacs regex (with wonderful re-builder) has got me far:
('0d69b2','pool chem room,'b69e08','spaces'), ('113243','weight room,'b69e08','spaces'), ('175118','custodial closet 3,'b69e08','spaces'), ('1baa68','life fitness,'b69e08','spaces'),
but right before second comma, need insert single quote. normal regex has me identify blob
^('\\w+','\\w+
then refer group \1 sub in group '
good, problem can't figure out how more first word of second field (after first comma). need way on before second comma, identify group, sub in group added '. right? or going @ wrong?
evaluationg progn-form should display result:
(progn (re-search-forward "\(\\('[[:alnum:] ]+',\\)\\('[[:alnum:] ]+\\)\\(,'[[:alnum:] ]+','[[:alnum:] ]+'\\)")
(message "%s" (concat (match-string-no-properties 1)(match-string-no-properties 2) "'" (match-string-no-properties 3))))
('0d69b2','pool chem room,'b69e08','spaces'),
Comments
Post a Comment