Search code examples
replacegreptagsbbedit

Convert all <div> to <p> using BBEdit Grep


Using BBEdit Grep, I want to convert all

<div>
Text
</div>

to

<p>
Text
</p>

The Text should, of course, remain the same, untouched.

I am using Search <div>([^>]*)</div> with Replace <p>\1</p>, but this Replace does not work when Text has tags, like <em>, or links.


Solution

  • Find: <(/?)div>

    Replace: <\1p>