View Single Post
Old 02-23-2014, 04:10 AM   #1
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
Question new regex question ( trailing 0 or 1 instance permultations

I could not see this covered in the regex sticky

I want to write a single find/replace that will zap all of

line-height:1.2;
line-height:1.3
line-height:1.2em;
line-height:1.2em
line-height: 1.2;
line-height: 1.3
line-height: 1.2em;
line-height: 1.2em

i.e. remove all fixed line heights in range 1-2 em from CSS.
NBthey may or may not have an explicit em & they may nor may not have a space after the first colon, and they may or may not have a trailing ;

I've got this far:
line-height:\s?1\.\d
I can't seem to also capture the last bits ?

update:
this works but it feels like a cheat, because it just grabs everything up to the next bit of white space. you could probably write a valid CSS with no white space between statements.
line-height:\s?1\.\d(.*)\s

Anyway, I'd like to learn the proper way to find and include zero or one instance of a given string

Last edited by cybmole; 02-23-2014 at 07:39 AM.
cybmole is offline   Reply With Quote