03-08-2014, 11:02 AM | #316 |
Junior Member
Posts: 4
Karma: 10
Join Date: Mar 2014
Device: Android
|
Thanks! It seems that I just got my self some bedtime reading
Now, if I want to search for something like the above, but dont know how much text there is, how do I do that? Example: I search for this: Code:
<p><a id="id1">This is the text that is in the note and I dont know how much there is. It changes for every note.</a><br /></p> Code:
<aside epub:type="footnote"> <div epub:type="footnote" id="id1"><br /> <p>This is the text that is in the note and I dont know how much there is. It changes for every note.</p> </div> </aside> |
03-08-2014, 03:49 PM | #317 |
Groupie
Posts: 171
Karma: 86271
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
|
regular expressions will be too brittle for this kind of thing. i think you should look into a programmatic way of parsing the html.
|
Advert | |
|
03-08-2014, 03:54 PM | #318 |
Junior Member
Posts: 4
Karma: 10
Join Date: Mar 2014
Device: Android
|
Don't wanna go into that.
I just simply search/replace in three steps. But thankyou for your help! |
04-16-2014, 01:39 AM | #319 | ||
Connoisseur
Posts: 81
Karma: 10
Join Date: Nov 2013
Device: Kobo Aura HD
|
Hi,
there is any way to find the word "τον" between italics and replace it with "του" For example: Quote:
Quote:
|
||
04-16-2014, 09:34 AM | #320 |
Well trained by Cats
Posts: 29,689
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
Advert | |
|
04-16-2014, 10:07 AM | #321 |
Grand Sorcerer
Posts: 27,468
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
That will only catch the second instance in the given example, Ducks (and only those instances that immediately precede a closing 'i' tag.
Pretty hard to come up with something that will catch multiple occurences only within 'i' tags (without multiple passes anyway). I have no idea how common that word is, but it might be easier to step through each occurence one by one and manually eyeball the ones that are in italic tags. |
04-16-2014, 10:16 AM | #322 | |
Well trained by Cats
Posts: 29,689
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Why spend all the time creating and testing a difficult REGEX for a 1 time use? Find or Replace Next. The buttons are a tiny mouse move away. |
|
04-16-2014, 10:31 AM | #323 |
Zealot
Posts: 142
Karma: 669192
Join Date: Nov 2013
Device: Kindle 4.1.1 no touch
|
|
04-16-2014, 11:09 AM | #324 | |
Grand Sorcerer
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Find:<i>(.*?)τον(.*?)</i> Replace:<i>\1του\2</i> You'll, of course, have to run it multiple times to find multiple occurrences of "τον" enclosed by <i></i> tags. |
|
04-16-2014, 11:32 AM | #325 | |
frumious Bandersnatch
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
<i>foo</i> τον <i>bar</i> Even with non-greedy modifier, the asterisk matches as many as needed to make the whole pattern match. |
|
04-16-2014, 11:51 AM | #326 | |
Zealot
Posts: 142
Karma: 669192
Join Date: Nov 2013
Device: Kindle 4.1.1 no touch
|
Quote:
BTW: Mine expression also isn't fool-proof as it would wrongly handle invalid HTML: <i>foo</i> τον bar</i> |
|
04-16-2014, 12:08 PM | #327 |
Grand Sorcerer
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
You're are of course right, but as DiapDealer has already pointed out, it's pretty much impossible to come up with a regex that covers all possible permutations. However, my simple regex covers at least the three most likely scenarios. I.e., an initial, medial or final occurrence of the search string.
|
04-16-2014, 12:39 PM | #328 |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
How about
Find:<i>([^<]*?)τον([^<]*?)</i> Replace:<i>\1του\2</i> |
04-16-2014, 02:00 PM | #329 |
frumious Bandersnatch
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
04-16-2014, 04:09 PM | #330 |
Connoisseur
Posts: 81
Karma: 10
Join Date: Nov 2013
Device: Kobo Aura HD
|
Thanks for the replies!
I tried the Find: (<i>)(.*?) (τον)(.*?)(</i>) Replace: \1\2 του\4\5 and works in many issues. @theducks there are 3552 "τον" in the doc i use as sample to check. with the regex. 312 |
Thread Tools | Search this Thread |
|
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 |