View Single Post
Old 06-20-2013, 07:36 PM   #13
mzmm
Groupie
mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.
 
mzmm's Avatar
 
Posts: 171
Karma: 86271
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
if all the spans are on the same line you could use the one below. if there are more than 3 spans it captures the first 3, then the next 3. if there are 5 it captures only the first 3.

i think i'd recommend not doing this with regex though.

Code:
find:
(?<=<span class="smallcaps">)([^<\n]+)(</span>[^<\n]*)(<span class="smallcaps">)([^<\n]+)(</span>[^<\n]*)(<span class="smallcaps">)([^<]+)(?=</span>)

replace:
\1\2\3\4\5\6\7
where you'd perform operations on \1, \4 and \7. so given

Code:
This will be a <span class="smallcaps">TEST</span>. This is a <span class="smallcaps">TEST</span>. This is no longer a <span class="smallcaps">TEST</span>.

Code:
first\2\3second\5\6third

This will be a <span class="smallcaps">first</span>. This is a <span class="smallcaps">second</span>. This is no longer a <span class="smallcaps">third</span>.
i'd initially grouped the first <span class="smallcaps"> in the lookahead and then inserted it like \2\3\1\4\5\1\6 but apparently sigil didn't like reusing the backreference. possibly a bug?

--edit

also the ([^<\n]+) is strange to me in that i had to include the \n so that it didn't match across lines. not sure why this is, though.

Last edited by mzmm; 06-20-2013 at 07:41 PM.
mzmm is offline   Reply With Quote