Quote:
Originally Posted by Psymon
For my regex search I initially came up with this...
<span class=\"initial\">(.+?)</span>([^>]*)\s
|
Try this instead:
Code:
<span class="initial">(.+?)</span>(\w*)
You don't need to escape the quotation marks in your search criteria. The \w will match only word characters, which means it will stop before any punctuation that might occur (an apostrophe in the word you want to smallcap will trip this up).
If any unicode characters can be expected, you may want to make the \w unicode-aware with the (*UCP) command.
Code:
(*UCP)<span class="initial">(.+?)</span>(\w*)
The (.+?) part can be a bit greedy. If one letter is all that's ever expected, I'd probably use (\w) instead.
Code:
(*UCP)<span class="initial">(\w)</span>(\w*)
If an opening quote may be in the raised|dropped cap as well, then explicitly include it (making it optional of course):
Code:
(*UCP)<span class="initial">(“?\w)</span>(\w*)
Probably gonna play hell on one-letter drop|raised-cap words, too ("I" and "A"), though.
Quote:
Originally Posted by Psymon
...and for replace this...
<span class="initial">\1</span><span class="smallcaps">\U\2\E</span>
|
The replace should work fine as is.
To eliminate the issue of one-letter word drop/smallcaps, I'd probably do something like.
FIND:
Code:
(*UCP)<span class="initial">“?\w</span>\K(\w*)
REPLACE:
Code:
<span class="smallcaps">\U\1\E</span>
EDIT: None of the optional regex search options should be checked (other than maybe the "wrap" option) for any of my examples, by the way.