02-21-2012, 08:26 AM | #16 |
frumious Bandersnatch
Posts: 7,536
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
So you want something like this?
Code:
<span class="italics">[^<]*\s.*</span> |
02-21-2012, 09:07 AM | #17 | |
Grand Sorcerer
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I had a mishap where an ill-thought-out global replace (because of nested spans and greedy expressions) left me with a boatload of long, incorrectly italicized passages. And it got saved before I caught it. I could've backed up a few revisions and started over, but I didn't want to ( maybe not always straight, but ever forward ). Anyway, since I know the one word occurrences aren't mistakes, I can safely skip those. And in this particular document... that little regex expression knocks the number of occurrences I have to manually proof against the original text from 700+ down to around 150. Thanks again! |
|
Advert | |
|
02-21-2012, 09:08 AM | #18 |
Connoisseur
Posts: 54
Karma: 37363
Join Date: Aug 2011
Location: Istanbul
Device: EBW1150, Nook STR
|
@DiapDealer: Does this narrow down your set enough? This one should match anything with at least one non-word(unicode) character in italics, including contractions but excluding empty spans(which should be easy enough to remove before- or afterwards.)
Code:
(*UCP)(?U)<span class="italic">[^<]*\W[^<]*</span> |
02-21-2012, 09:25 AM | #19 |
Grand Sorcerer
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
@Timur: a non-word character in the target isn't required, but any multi-word instances that happen to contain non-word characters needs to be included by the search, too. (also... that expression crashes my Sigil 5.1 )
I've yet to find an instance where Jellby's expression skips something that I wanted included. And I've given it a hell of a workout so far. This is the non-beta version of what is now working outstandingly well for me. Code:
(?U)<span class="italics">[^<]*\s.*</span> |
02-21-2012, 09:53 AM | #20 |
Connoisseur
Posts: 54
Karma: 37363
Join Date: Aug 2011
Location: Istanbul
Device: EBW1150, Nook STR
|
Strange that my pattern causes a crash, I use 0.5.1 here too and it works. Anyway, I am glad that you have found a regexp working for you.
|
Advert | |
|
02-21-2012, 10:25 AM | #21 |
Grand Sorcerer
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
02-23-2012, 12:57 AM | #22 |
Evangelist
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
|
A few people have asked me for a nice way to change CSS class formatting for simple print types into their relevant basic tags, I often use something like this :
Code:
Find: (?si)<span[^<>]+(?:class="(?:(i)talics?|(b)old|(u)nderlined?|(s)trikeout)")[^<>]*>(.+?)</span> Replace: <\1\2\3\4>\5</\1\2\3\4> |
03-24-2012, 10:35 PM | #23 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Hi
I am no expert at all so forgive me. I still have in my notebook a Regex that Zelda of world fame gave me a long time ago: <span.sgc-5>([\w\s]*\w)</span> I need to add a span tag to a span tag (that is to make a double span) without touching or removing the capital letter enclosed in the span. It's to make a box for drop-caps. To make myself understood, I need to search and replace using Sigil, in code view, for all html files: search <span class="lettrine2">X</span> replace <span class="lettrine1"><span class="lettrine2">X</span></span> X of course can be any letter from A to Z (capital letters only) I had no success with the above Regex. Has anybody a solution for it? I guess only \w would be needed since there is no space. Last edited by roger64; 03-24-2012 at 10:44 PM. |
03-25-2012, 01:55 AM | #24 |
Well trained by Cats
Posts: 30,452
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Search:
Code:
(<span class="lettrine2">[A-Z]</span>) Replace: Code:
<span class="lettrine1">\1</span> |
03-25-2012, 04:57 AM | #25 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
@theducks
Works beautifully. Thank you very much. |
03-28-2012, 09:04 PM | #26 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Hi
I have one wish that could be of interest for French users. We currently use before the following punctuation signs : ; ! ? and inside the French quotes and before an endnotes call. Seven possible occurences (at least for punctuation purposes, because there are other uses of this entity). However, our typographic rules suggest to use - preferably - a narrow no-break space that we call "espace fine insécable". When? Before the three following double punctuation signs ; ! ? and inside the French quotes and before an endnotes call. Six possible occurences. However, this entity is mishandled by ADE and other -old generation- ebook-readers, even if we use appropriate fonts. So, for the time being, it's a little useless. That's why, meanwhile some people try to emulate this narrow no-break space from the no-break space. I found two CSS solutions for this. Admittedly they are not optimal because they will leave a lot of spans. At least, it's a choice. L'émulation 1 texte<span class=«fine»> </span>texte Code CSS: .fine {font-size: 30%;} L'émulation 2 </span class=«fine»> </span> Code CSS: .fine {display:inline-block;width:0.125em} I would like to have an advice which of the two seems better? I also would like to use one Regex to search and replace using one of the two span classes above. If I make a plain search and replace, it would have to be played six times. I hope there is a Regex to wrap everything and play it only once. Phew, it was a long post but I tried to be clear. Thank you for your help. Last edited by roger64; 03-29-2012 at 12:40 AM. |
03-29-2012, 10:06 AM | #27 |
frumious Bandersnatch
Posts: 7,536
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Be careful, you have class=«fine» instead of class="fine". Guillemets are not for everything
|
03-29-2012, 10:55 AM | #28 | |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Quote:
I will probably go this way: As the characters ; and ? can be misunderstood in Code view, - first in source odt file, search occurence of no-break space with ([; ! ? »]) and replace it with a neutral character. Same for « - then, in Sigil in Code view (Book view F&R is said unsafe?) search this neutral character and replace it with the span above with English quotes. After that, I'll see if the reader is not too sluggish with all these new spans. |
|
04-04-2012, 04:04 AM | #29 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
I have a problem where hopefully a RegEx can help me. I want to find all words ending with f, with the exception of a few words. So, I want a hit on for example 'dwarf', but not on 'of' or 'behalf'.
The first part I can cover with \b\w+\b, but can I filter the results with an kind of exception list? I can't seem to find that. *update* I seem to have found it, but I need to test further. This seems to do what I want: \b(?!of|behalf)\w+f\b Last edited by Toxaris; 04-04-2012 at 04:16 AM. |
04-04-2012, 07:16 PM | #30 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Sorry Toxaris
I wish to set this span around some selected tags (according French punctuation rules). </span class="fine"> </span> A simple Find and Replace regex allows me to do it in Code view. However, I can create the desired tags but only one by one. When I intend to perform a global F and R, the result is reported but in fact not executed. Once created one by one, I can have a look at them in Code view. So, I am not dreaming. Worse, the created spans are automaticaly erased by Sigil the next time I come back to Code view from Book view. I am sure it is possible to ask Sigil not to erase anything but I do not find how : for example, the same instance of Sigil respects these exactly same span tags around the entities on one document (alas! not created by me) but it removes them on mine. HTML Tidy is not involved. I do not touch its button. I really would like to be able to perform a global Find and Replace and to keep my changes. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Examples of Subgroups | emonti8384 | Lounge | 32 | 02-26-2011 07:00 PM |
Accessories Pen examples | Gunnerp245 | enTourage Archive | 15 | 02-21-2011 04:23 PM |
Stylesheet examples? | Skitzman69 | Sigil | 15 | 09-24-2010 09:24 PM |
Examples | kafkaesque1978 | iRiver Story | 1 | 07-26-2010 04:49 PM |
Looking for examples of typos in eBooks | Tonycole | General Discussions | 1 | 05-05-2010 05:23 AM |