4

i have string

<font><font>sdasdsa</font></font>

how to match string with regex

<font>sdasdsa</font>

i tried this pattern but it cannot match

<font>[^(<font>)]*?</font>
1
  • 1
    If you know, there's no tags inside <font>...</font> the simplest way possibly is just to match negated < between. Pattern like ~<font>[^<]*</font>~ (see regex101) Commented Jun 7, 2015 at 14:26

1 Answer 1

3

You can use the following:

<font>(?:(?!<font>).)*?<\/font>

See DEMO

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.