View Single Post
Old 11-03-2015, 07:25 AM   #1
crankypants
Hmm.
crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.
 
Posts: 124
Karma: 2016606
Join Date: Oct 2015
Device: Android 4.2 Google Play Reader
How to change CSS to comments but retain original numeric values

Sigil 0.8.7

I mentioned in another thread that I'm cleaning up a public EPUB from another author and commenting out tons of CSS that the reader should handle. One problem is the author (or their editor), changed the background color and line height in the CSS, and I want to use regex to comment them out. I want to change
Code:
line-height: 100%
to
Code:
/* line-height: 100% */
but if the percent is a different number, I want to keep that number. Here's how I did it, it will work with any percent number.

My regex search is: line-height: (\d+)%;?

My regex replace is: /* line-height: \1%; */

'\1' is the place holder for what was found in between (), which was (\d+).

Last edited by crankypants; 11-03-2015 at 08:37 AM.
crankypants is offline   Reply With Quote