Fixing bad quotes

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
JBNY
Posts: 7
Joined: Wed Mar 25, 2009 7:24 pm

Fixing bad quotes

Post by JBNY »

Hello,

I am trying to find a regex to fix quotes in a document for example:

change

'Good. Then let's do it.'

to

"Good. Then let's do it."

I've tried the find expression
'((\\')|[^'(\\')])+'

and

'[^'\r\n]*'

but both catch the ' in let's as a quote as well.

Any ideas?

Thanks!
-Joe
User avatar
talleyrand
Posts: 625
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

As soon as I post this, someone will correct me but I don't think this is a problem that regex is going to solve. And if it can, I don't think the current regex engine in TP will handle the solution.

The two big challenges you will encounter are multi-lines aren't supported and the parser is always greedy.
I choose to fight with a sack of angry cats.
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

I wonder if the SmartyPants Perl filter would be any use here.

This translates plain ASCII punctuation characters into “smart� typographic punctuation HTML entities. From there it would be a trivial search and replace to get back to the quotes you are after.

If it is only one document, and you can send it to me I would be happy to give this a try.
Running TextPad 5.4 on Windows XP SP3 and on OS X 10.7 under VMWare or Crossover.
Post Reply