![]() |
#1 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 447
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
Backreferencing "or" expressions
I want to find all instances of quotation marks inside <i> tags
Code:
<i>“|”</i>
I was using the following test string: Code:
<p><i>“Hello, I love you,”</i> I said.</p> <p><i>“Won't you tell me your name?”</i></p> Code:
<p>“<i>Hello, I love you,</i>” I said.</p> <p>“<i>Won't you tell me your name?</i>”</p> Last edited by ElMiko; 07-31-2012 at 07:59 AM. |
![]() |
![]() |
![]() |
#2 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,549
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
I'm not sure it works in Sigil's regex dialect, but this seems to work in vim:
Code:
%s/\(<i>\)\(“\)\|\(”\)\(<\/i>\)/\2\1\4\3/g search: Code:
(<i>)(“)|(”)(</i>) Code:
\2\1\4\3 |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
|
Dont see why you're trying to do fancy stuff, given the very easy sample set, it might be worth just using the simplest case:
Code:
Find : <i\b[^<>]*>([^“]*)“([^”]+)”([^“”]*)</i> Replace : \1“<i>\2</i>”\3 |
![]() |
![]() |
![]() |
#4 |
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 586
Karma: 2000358
Join Date: Aug 2010
Location: Alabama
Device: Archos, Asus, HP, Lenovo, Nexus and Samsung tablets in 7,8 and 10"
|
Would't this work?
Find: Code:
<i>“(.*?)”</i> Code:
"<i>\1</i>" |
![]() |
![]() |
![]() |
#5 |
Berti
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,197
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 447
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
PS - this is why I don't like giving sample sets.... because people try to match the sets instead of the premise. Indeed, the italic/quotation mark search is merely the scenario that inspired me to look for an answer to the "or" backreference question, but there is literally an infinitude of "or" searches.
Nevertheless, I do i appreciate the help you've all volunteered on the quotation mark issue. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
KT "Ghost covers/files" again at 670 books, "stale" image entries in firmware | VirgoGirl | Kobo Reader | 4 | 04-06-2012 02:10 PM |
Feature Request: configurable space setting for "Insert blank line" in "Look & Feel" | therealjoeblow | Calibre | 15 | 07-25-2011 03:14 PM |
Sigil 024 and regular expressions on "all HTML files" | WS64 | Sigil | 4 | 08-13-2010 07:33 PM |