0

I would like to use regular expression to find given font-family and replace that font-family with mine font; in my string and remove that from so the return value is the original string without new font family applied on it.

Ex.

<span style="font-family: TimesNewRoman; font-size: 12"><p>My text<br /><br />
<span style="font-family: 'Georgia','serif'; color: #1a1a1a;">Description is here</span> Detail description</strong></p>
</span>

Here I want to edit ‘Georgia’ with TimesNewRoman Note: ‘Georgia’ will be dynamic

Bhavesh Nayi
  • 3,626
  • 1
  • 27
  • 42
  • http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – Paulw11 Nov 09 '16 at 06:46

1 Answers1

1

Try this:

(?<=family\:\s)[\s\S]*?(?=[;\s])

Demo: https://regex101.com/r/qv7Zrw/1

Ibrahim
  • 6,006
  • 3
  • 39
  • 50