11-18-2014, 02:39 PM | #436 | |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
But they should correctly have found #1 and #3, and I cannot see why they would find, for example, Code:
<p>"Hello."</p> Code:
[^"”]</p> |
|
11-18-2014, 03:01 PM | #437 | |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
Find: Code:
\b(\p{L})((?:\p{Ll}*\p{Lu})+\p{Ll}*)\b Code:
\1\L\2\E Other than that, the only real difference from Doitsu's regex is that I specifically looked for uppercase letters inside the match, rather than applying an equalizer on all words -- this has the same result, but ignores matches where we wouldn't end up changing anything. |
|
Advert | |
|
11-18-2014, 03:05 PM | #438 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
On an almost-related note, Kovid Goyal has just (as of 6 hours ago) begun work on function mode in calibre's editor!
|
11-19-2014, 02:00 PM | #439 |
Member
Posts: 12
Karma: 79192
Join Date: Nov 2014
Device: Kindle
|
|
11-19-2014, 02:24 PM | #440 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
|
Advert | |
|
12-04-2014, 06:21 AM | #441 |
Banned
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
Hi,
i'm currently working on combining paragraphs. I've a bunch of regex' which are working fine. But for this: Code:
...he went on,</i></p> <p><i> shaking his head... What i can do is of course something like this: ,</i></p>\s+<p><i> to replace it with , and have one for italic, one for bold (or even combine them with | but is it possible to have that a little bit more in general? Thx rubeus |
12-04-2014, 03:34 PM | #442 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Simple, a backreference.
Capture the first used tag, and match it later -- yes, backreferences work inside the regex, not just for replacing. Instead of: Code:
,</i></p>\s+<p><i> Code:
,</(i|b|others)></p>\s+<p><\1> Code:
,</(i|b|others)></p>\s+<p( .+)?><\1> |
12-05-2014, 07:32 AM | #443 |
Banned
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
Thanks, and i will read this chapter
To be honest, i'm doing that, but was too lazy to write this down in my example |
12-05-2014, 09:00 AM | #444 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
|
12-29-2014, 04:05 AM | #445 |
Connoisseur
Posts: 57
Karma: 10
Join Date: Dec 2011
Device: Samsung Tablet
|
Have I over-complicated this?
My aim was to come up with one regex to find ‘s and <space>‘s that followed any Unicode text and could be followed by either a space or punctuation, then replace the curly quote and remove the extra space. Find Code:
((?<=([\p{Ll}]))‘s(?=([\p{P}|\s]))|(?<=([\p{Ll}]))\s‘s(?=([\p{P}|\s]))) Code:
’s fooè ‘s foo foo‘s foo fo's foo ‘s foo ’s dog ‘scooter’ |
01-02-2015, 01:59 PM | #446 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Code:
(?<=\p{Ll})\s?‘s(?=\p{P}|\s) |
01-02-2015, 02:36 PM | #447 | |
Connoisseur
Posts: 57
Karma: 10
Join Date: Dec 2011
Device: Samsung Tablet
|
Quote:
Changing it a little more I've started looking for things other than the s, allowing for uppercase and full stops. Code:
(?<=\p{Ll}|\p{Lu}|\.)\s?‘(d|m|s|t|ll|re|ve)(?=\p{P}|\s) |
|
01-02-2015, 03:24 PM | #448 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Code:
(?<=\p{L}|\.)\s?‘(d|m|s|t|ll|re|ve)(?=\p{P}|\s) Do you anticipate any of these happening after a full stop? Perhaps that should be fixed... I can hear there being an uppercase word, e.g. someone screaming. Last edited by eschwartz; 01-02-2015 at 03:26 PM. |
01-02-2015, 03:55 PM | #449 |
Connoisseur
Posts: 57
Karma: 10
Join Date: Dec 2011
Device: Samsung Tablet
|
Thanks again. The full stops count for the abbreviations ie A.B.C. ‘s
|
01-02-2015, 04:27 PM | #450 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Oh, OK -- makes sense now.
And you're welcome. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Examples of Subgroups | emonti8384 | Lounge | 32 | 02-26-2011 06:00 PM |
Accessories Pen examples | Gunnerp245 | enTourage Archive | 15 | 02-21-2011 03:23 PM |
Stylesheet examples? | Skitzman69 | Sigil | 15 | 09-24-2010 08:24 PM |
Examples | kafkaesque1978 | iRiver Story | 1 | 07-26-2010 03:49 PM |
Looking for examples of typos in eBooks | Tonycole | General Discussions | 1 | 05-05-2010 04:23 AM |