... AA BB sysodufsoufdds BB AA ...
Where AA,BB can be arbitary consecutive string with no space in it.
But I want to get the outest pair:AA
More examples:
Input:
a HH CC abc CC HH c
Output:
HH
Input:
x YYYY j DD GG DD hsu DD GG DD k YYYY o
Output:
YYYY
To make my question more general,how to match a specific tag in html with regular expression?I've seen various posts discussing about this,but none of them give a answer by regex.Related questions are: I'm looking for a regular expression to remove a given (x)HTML tag from a string
AA str1 BB str2 BB str3 AA(i.e. there is more than white space between the paired strings).AA