I almost considered apologizing in advance for the convoluted question, but better late than never: sorry, everybody! I realize this is a little tricky to understand
Let's say i have the following <p> elements:
Code:
1. <p class="lorem">....1...</p>
2. <p class="lorem">----2---</p>
3. <p class="lorem">___3_____</p>
4. <p class="lorem">_._--__4..----</p>
5. <p class="lorem">aaa5aaaa</p>
I am looking for regex that will match examples 1, 2, 3, and 5,
BUT NOT 4.
That is to say, I'm looking to match a <p> element where the number is nested withing any string of
repeating characters, and then isolate the number for reuse in a replacement function
@Haudek - I think we're getting close, although i don't think I see any backreference in the first half of the regex...
EDIT1 — SOLVED:
Thanks, Haudek. Your regex got the ball rolling. I'd forgotten that backreferencing works within the search field (not merely in the replace field).
Code:
<p[^>]*>(.)\1*?([0-9]+)\1*?</p>