Do I really need to learn regex?

Regular Expression. You know, they call it that, but it’s not exactly “regular” in my opinion. This is a very complex way of describing what you’re looking for. Granted, it is extremely flexible!

We can use regex is a variety of products that we use on a day to day basis, including one of the more common systems, being VCS. That being said, I just had to go back and relearn some regex to form an expression for my call recording software.

The problem? All calls were being recorded, but the business only wanted external calls to be recorded.

The solution? You guessed it, a regex rule.

There is a youtube channel I highly recommend for learning the basics of regex. Derek Banas has a three part series on it:
Part 1: https://www.youtube.com/watch?v=DRR9fOXkfRE
Part 2: https://www.youtube.com/watch?v=FCFdgymqpUI
Part 3: https://www.youtube.com/watch?v=lvGtejG69zg

My usage today is fairly simple, I want to exclude recordings for any 4 digit extensions, but maintain recordings for 10 digit extensions.

My best friend for testing my expression? https://regex101.com/

The first thing I want to figure out how I can define a number of digits. The expression \d{#} will define a set amount of digits. Replace the pound sign (hash tag, whatever you want to call it) with an actual number.

So if I want to define 4 digit extension, I would say \d{4}.

If I wanted to match BETWEEN 4 AND 6, I could replace 4 with 4,6. Or if I needed to match a specific digit, I could use brackets and say [4|6], this would match 4 OR 6.

Now I have defined \d{4}, but it is still matching 10 digit numbers because it just matches multiple strings of 4 in each number. So how do I rule this out?

I will need to define the start and end point so that it doesn’t continue matching the same line.

So to do that, I need to add an upward carrot at the beginning to define the beginning of a string, and a dollar symbol at the end to notate the end of the string.

Lets add that in and see how that matches:

Bingo! We are successfully matching only 4 digits. Now, lets apply that to our call recording software.

So you can see my two rules above, I matched the inbound caller ID and the outbound caller ID to my expression, and defined do not record.

Most call recording platforms that I have seen have similar capabilities for rules. So just make sure to know your product.

Now lets check and see if this is actually working. Of course, I had to blur a lot out on this image to protect privacy and security, but if you look under the two columns inbound ID and outbound ID, you will ONLY see outside calls, no internal 4 digit extensions.

Success! Keep in mind, this is a VERY basic discussion about regex and once you start looking at VCS, it becomes quite a bit more complex. So this is really just a good starting point to start learning regex and figuring out how to form various strings.

How often do you find yourself using regex? And do you remember it after that, or do you have to relearn it every time you need it?

Leave a Reply

Your email address will not be published. Required fields are marked *