Regex CSS Style Attribute replacements

I want to selectively replace an attribute value within a CSS Style string…

The string:

"font-size:13pt;font-weight:600;line-height:140%;padding-top:10px;font-family:'Open Sans', 'Droid Sans', Arial, sans-serif;color:#7f1a52;padding-bottom:5px;vertical-align:middle;background-color:; text-align:center;align:center;"

I want to selectively replace the "center" in text-align and align, but NOT the middle in vertical-align.

So far I have


but that will also replace the middle in vertical align.

How can I exclude vertical-align:middle from being selected within this string??

Source: JavaSript – Stack Overflow

November 25, 2021
Category : News
Tags: javascript | regex

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.