parenthesis around quotes - start of line/before attribution

Find, replace, find in files, replace in files, regular expressions

parenthesis around quotes - start of line/before attribution

Postby lobotomy » Sun Feb 12, 2006 7:23 pm

I'm trying to accomplish something that may (perhaps) be impossible to do with a search/replace regexp....here goes...

I have a quote file which has this format:
this is a quote.--Quote Author

I would (ideally) like to end up with this format:

"this is a quote."--Quote Author

in other words;
at the beginning of the line insert parenthesis "
after the period, and before the attribution dashes, insert another parenthesis "

I've tried various approaches, and also read widely through this part of the forum, but haven't found any way to do this yet. Help would be greatly appreciated!!

Regards & TIA
Lobotomy
(because only one half works)
User avatar
lobotomy
Newbie
 
Posts: 1
Joined: Sun Feb 12, 2006 12:00 am

Re: parenthesis around quotes - start of line/before attribution

Postby mrainey56 » Sun Feb 12, 2006 8:57 pm

You said insert parentheses, but you wrote quotation marks.

Try thus Unix-style regex search/replace

Search: ^(.+)[.]--(.*)$

Replace: "\1."--\2


substitute parens for quotes in the replace string if you like.

read about tagged expressions in the regular expression section for more insight
User avatar
mrainey56
Master
Master
 
Posts: 212
Joined: Tue Jul 27, 2004 11:00 pm
Location: Spartanburg, South Carolina

Re: parenthesis around quotes - start of line/before attribution

Postby Bego » Sun Feb 12, 2006 8:59 pm

Hi guys

In UNIX-STYLE (see your search-settings) try this:

search
^([a-zA-Z].*)--
replace with
"\1"--

rds Bego
User avatar
Bego
Master
Master
 
Posts: 357
Joined: Wed Nov 24, 2004 12:00 am
Location: Germany


Return to Find/Replace/Regular Expressions