Like Perkins, i'm a little befuddled as to the technical reason why the first search fails (It's a problem i've wrestled with before). It's got something to do with a conflict between the "or" symbol and the parentheses. But as I say, the nitty gritty of the regex issue escapes me. In order to achieve the matching result intended by Perkins original search, you need to restate each span in its entirety:
Code:
(?<=span class="italics">|span class="bold">)(.*?)(?=</span)
@JSWolf—All that being said, your question is unclear. Are you looking for a search that will match
either span or
both spans? And if it's the latter, the above regex will do the trick. If it's the former, it will be too greedy, and you obviously have to limit the look-behind to the desired span class. Also, are you just looking to match "bold" and "italics" spans, or are you trying to match all spans? if the latter, then you may want to use:
Code:
<span[^>]*>(.*?)</span>
note that this search will (unlike the lookbehind searches) include the span code itself, as well as the text that it is modifying.