View Single Post
Old 12-16-2019, 06:17 AM   #1
Capricorn
Belgian Pommes Frites
Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.
 
Posts: 122
Karma: 35038
Join Date: Jan 2012
Device: Pocketbook Touch HD
Question on a conditional regex

I have been banging my head against the wall trying to figure out how conditional regexes work.

I have looked at http://rexegg.com/regex-conditionals.html to figure it out, but no luck so far. My understanding of regexes has not advanced enough that I can put this level of regexes together.

I want to have a conditional regex that says:

if "font-size: 1.0em;" then leave it as it is.
if font-size is anything else, then change it to font-size: xyz;

And I want to do the same for the font-family: xyz;

If possible, it should also work in text files, not just stylesheets, in case I find the occasional statement like:
<span style="font-size: 1.0em">XXXXX</span>

I would appreciate it if someone could help me with such a conditional regex.
.
Capricorn is offline   Reply With Quote