There is a line:

<p>=1= Текст1</p><p>=2= Текст2</p><p>=3= Текст3</p> <p>=2= Текст4</p><p>=1= Текст5</p> 

It should be replaced by:

 <p class="myclass1">Текст1</p><p class="myclass2">Текст2</p><p class="myclass3">Текст3</p> <p class="myclass2">Текст4</p><p class="myclass1">Текст5</p> 

That is, between equally equals a class identifier for easy searching and not to confuse it with other numbers in the string. The code can be from 1 to 9. Instead, it is equally possible to come up with something else.

Is it possible to make such a replacement using replace ()?

    1 answer 1

     <p>\s*=(\d)=\s+(.+?)<\/p> 

    change to

     <p class="myclass$1">$2</p> 

    demo