更新时间:2022-10-22 10:59:44
我想通了 - 使用反向引用。
(['])(小于?Q>?+)\1
Question 1:
For example,
... "ab'cd" ... 'ab"cd' ...
It should get ab'cd
and ab"cd
respectively. There may be many quoted strings.
Question 2:
And how to extract text <td>...</td> text
from the following string?
<abc>text <td>...</td> text</abc>
<xyz>text <td>...</td> text</xyz>
<def>text <td>...</td> text</def>
abc, def, xyz may be nested in <td>
.
I figured it out - using back reference.
(["'])(?<q>.+?)\1