NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
please help me with a find/replace regular expression


Joined: 06 Jan 2010
Posts: 4
Reply with quote
Hi all,

I want to do a find/replace in multiple .css files using both the Multiline search and the Regular expressions. Unfortunately my regexp skills are very limited.

Here is what I want to do:

I want to replace

"
background-size: 20px 20px;
"

by

"
background-size: 20px 20px !important;
-webkit-background-size: 20px 20px !important;
"

Where 20px can be any number

Alternatively, 20px 20px could be *anything* *anything* as sometimes it could be "auto".

The tricky part is that I'm not sure how to tell nusphere to use the *anything* *anything* in the new insertion in the "Replace with"

Hopefully this can be done as it would save us a ton of work doing these replacements manually in hundreds of css files.

Thanks to anyone that can help!!
View user's profileFind all posts by vesper8Send private message


Joined: 06 Jan 2010
Posts: 4
Reply with quote
well.. this wasn't as hard as I thought it would be...

I'm getting close now.. it works in my first example using:

find:
background-size:[\s]*(.*)px[\s]*(.*)px;

replace with:
background-size: \1px \2px !important;
-webkit-background-size: \1px \2px !important;

Now I just need to figure out how to make it work when "auto" is used.
View user's profileFind all posts by vesper8Send private message
please help me with a find/replace regular expression
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic