Using a strong Naming Convention & RegEx are keys to automating metrics!

naming conventions

Naming Convention and Regular Expression (RegEx)

Having a strong naming convention can make reporting on your metrics a breeze when you use a regular expression to break out-decrypt the naming scheme. This video shows how easy it is for us to extract: Region, Language, Campaign Type, etc. from our campaign names by using a regular expression. It also points out that there is no need to be stuck with poor acronyms for your reporting.Group of coworkers seated around a table in a bright office, talking together with a green reusable water bottle in front of them

In my above example I use AutoHotKey with Excel.  If you add the function, Excel can do RegEx itself however (for some crazy reason) it isn’t built into it.

Regular Expressions to automate metrics is an investment everyone should do!

regular expressions to automate metrics

Regular Expressions

Regular Expressions to automate metrics

I’ve written a script that logs into our vendor website and exports the recent email campaigns then breaks them out by region, campaign type, Business Unit, etc. and links them back to our SharePoint site for more information.  The script relies on a regular expression to automate metrics on our long string name and parse-out sections by examining patterns in the Naming convention.

My script first logs into our tool (SilverPop) and performs web scraping to capture the data and dumps it to a local HTML file.  I then use Excel to import the HTML file and start parsing the naming convention with the regular expression.   After all the columns are created I replace some of the short abbreviations with longer, easier to understand, words.   Then I insert functions aggregating the metrics by Type of campaign, Region, Language etc.   After that I break out four regions.  All in all it takes about 10 minutes to run but saves me about 40 hours worth of work.  The below video demonstrates the regular expressions to automate metrics in action

Using 6 built-in SciTE Find and Replace features- Great time savers!

It always amazes me of how frequently I have to manipulate text I in various ways.  More often than not it is simply doing a SciTE find and replace but being able to have other ways to manipulate text is also a great time saver!

In this video I walk through some of the tips & tricks of using SciTE search and replace text within the text editor.  I also demonstrate one of the “coolest” features which is block / typing across multiple lines.  This is a GREAT feature which many do not know how to use.  The Regular Expressions and dealing with line returns / new lines are also very helpful.

 

SciTE find and replace

In the video I also showed how I updated my AutoHotKey SciteUser.properties file.  Below is the line I added
#### Changing SciTE Find and Replace to posix regular expression mode so do not have to escape parens
find.replace.regexp.posix=1

And here are a couple of helpful pages with SciTE  documentation, SciTE RegEx documentation

Demonstration of SciTE Find and Replace Features

To avoid having to escape parens (watch above video) add the following in your SciTE user.properties file.   If set to 0, syntax uses the old Unix style where \( and \) mark capturing sections while ( and ) are themselves.  If set to 1, syntax uses the more common style where ( and ) mark capturing sections while \( and \) are plain parentheses.

find.replace.regexp.posix=1

Here are some useful POSIX terms which are more readable in your SciTE Find and Replace

[:xxx:] were xxx is one of the following words:
NAME DESCRIPTION
alnum    letters and digits
alpha    letters
word “word” characters (like \w)
digit    decimal digits (like \d)
space    white space
punct    printing characters, excluding letters and digits
lower    lower case letters
upper    upper case letters