Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
<(\/?)b\b((?:[^>"']|"[^"]*"|'[^']*')*)>
/
gm

Description

Replace old formatting HTML tag <b> with semantic <strong> tag. It can be used as a template for replacing any HTML tag, like <i>, etc.

Submitted by O’Reilly Regular Expressions Cookbook - 3 years ago