troubleshooting Question

RegExp to complete

Avatar of lightspeedvt
lightspeedvt asked on
Regular ExpressionsScripting LanguagesJavaScript
33 Comments1 Solution769 ViewsLast Modified:
Hi Experts,

I've come to one RegExp on my own and it is near perfect to my needs, but it is needed to solve one issue.

Here is the income string:

section{  font-size  :  22px  ;    color : #cecece; } @media { #holder{ color:#cecece; font-size : 10px; border-color:#cecece; font:color sasd;   font:border-color; }  article{ font-size:14px; } header { color:#ffffff; } } .element{font-size:20px;} section{ font-size:12px; color:#cecece; } @media() {.element{font-size:20px;}} section{ font-size:12px; color:#cecece; font-weight:bold; } footer{color:#cacaca;  font:border-color, color, more, color; color:border-color, color, more, color; font-size:1111; font-size:color getting, better; color: color; font-size: more color;} test{font-size:10px;color:zzz;}

Regular expression:


Here is the highlighted result screenshot at 
Issue is that at some reason it selects all text that comes after words "border-color" and "color" that are listed with (border-color|color) up to symbol ";". I am trying to fix it, to not select those text if the needed word exist till ";". I've did a screenshot marked with red rectangle of what should be omitted in search results
Results marked with red rectangle that shouldn't be included
Also, here is the logical explanation what I am trying to achieve: RegExp has to select all text that hasn't needed word up to symbol ";" (including those symbol)  inside { .... }. If at least one of needed word exists inside those part of text - it should remain up to symbol ";".

Want to notice that it is needed to work under Javascript, so Lookbehind Assertions won't work.

This question is connected with my previous question:
I still wasn't able to get all in one RegExp at those question, so I've decided to work more on my own and simplify task.

I will be very thankful if somebody will help me to complete with this.
Join our community to see this answer!
Unlock 1 Answer and 33 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 33 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros