![]() |
#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> |
![]() |
![]() |
![]() |
#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.
|
![]() |
![]() |
![]() |
#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! |
![]() |
![]() |
![]() |
#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:
|
||
![]() |
![]() |
![]() |
#320 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,094
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
![]() |
![]() |
![]() |
#321 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,645
Karma: 204624552
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. |
![]() |
![]() |
![]() |
#322 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,094
Karma: 60358908
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. |
|
![]() |
![]() |
![]() |
#323 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 142
Karma: 669192
Join Date: Nov 2013
Device: Kindle 4.1.1 no touch
|
|
![]() |
![]() |
![]() |
#324 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,736
Karma: 24031401
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. |
|
![]() |
![]() |
![]() |
#325 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,555
Karma: 19500001
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. |
|
![]() |
![]() |
![]() |
#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> |
|
![]() |
![]() |
![]() |
#327 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,736
Karma: 24031401
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.
|
![]() |
![]() |
![]() |
#328 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
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> |
![]() |
![]() |
![]() |
#329 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,555
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
![]() |
![]() |
![]() |
#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 | 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 |