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
Fixing bad quotes
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
- talleyrand
- Posts: 625
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
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.
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.
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.
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.