Trying
Trying

Reputation: 79

Emacs regexp - replacing text strings, query replace regexp

It seems simple enough but I can't get it done. My text file looks like this :

Johnson Cary, 2009, This important article, 109 pages.

Smith Tom, 2003, Much ado about nothing: a study, 89 pages.

I need this :

Johnson Cary%2009%This important article%109 pages.

Any special character unlikely to appear in text will do. The end goal is to end up with a .csv then a .xls file.

I am using

^\([^,]+\)\([,]\)

to find the first occuring comma but when I try to replace with

 \1 %

it does not work, nor any kind of close combination of that sort for that matter.

Any help will be dearly welcome!

Thank you much in advance.

Upvotes: 0

Views: 64

Answers (1)

jlahd
jlahd

Reputation: 6293

Replace this:

^\([^,]*\), \([^,]*\), \([^,]*\), \(.*\)$

with this:

\1%\2%\3%\4

to get the correct result.

Upvotes: 1

Related Questions