Atom RegExp Search+Replace: Exact Match Symbol+AlphaNumeric with OR Ending Semicolon for Classes

Why is this important?

I am basically converting all of the colors on the web application to color variables. Now that I have a list of all of the colors, I am replacing close color matches to a main color variable name to consolidate a color code palete.

Attempting?

I am trying to find out how you would write a regular expression for an exact string match. The regular expression search & replace is for the ide Atom where I can search for specific classes without doing variable overrides; like $color_base1 and $color_base11. The default word match will not work in this scenario sadly because of the prior example.

Also, the end of the variable can end in a semicolon or no; so an or statement ending match. Goal is to have an exact regExp match for variables names that are "$color_base1" & "$color_base1;"

What I have so far? I know its bad.. I am learning. :(

I would greatly appreciate any guidance and advice on how to achieve this,

 ^\W$\bcolor\W__\blayoutBody

Answers


\$color_base1(;|\b)

https://regex101.com/r/bN4mA1/2

I was a little bit unclear on whether you wanted to match "$color_base11" or not. If you do, change the regex to this:

\$color_base\d+;?


Need Your Help

Ember.Select two way binding for edit form

javascript ember.js

In my ember application I have defined a select element like this in my template:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.