Tag Archives: posix

Regex – Conditionally Modifying User Data to “Title Case” for Phone Labels

Sadly a lot of UC is well, about those pesky end users.  This generally involves user data of some sort, and inevitably this is bad data.  Formatting text to get your 1k users can be a pain – even when the AD team you are working with are on top of things.

As an example, something I see a lot is changing data looking like this:


To this:

AS Jones – x1234

This requires a conditional match, moving things around, and a case change (Title Case).  The first 2 letters are initials, so I need to account for those as they must stay capitalized.

Excel requires a number of steps to do this.  I need to use a text editor here or a CLI tool like SED.  For me, Notepad++ is my poison of choice as I’m still bound to Windows.  Its a good tool use.

Firstly, I could try and use it’s built-in features available:



But this doesn’t give me the CONDITIONAL control that I want.  Using Excel is even worse.  I hate it and try avoid it at all costs.   I need REGEX to complete this task.


My requirement is completed using tagged expressions and the following:

  • \L – Translates everything to lowercase until the end of the replacement string
  • \u – Translates the next letter to uppercase

I’m not going to go into detail on the rest, as if you’re a voice engineer on Cisco – you know the rest already (I hope!).


So let’s look at his this is achieved in Notepad++:

  • Input: 1234-AS JONES
  • Regular Expression: ^([0-9]{4})-([A-Z]+) ([A-Za-z]+)
  • Replaced with: \2 \L\u\3 – x\1

The output is now exactly what I want:

AS Jones – x1234

In NPP the regex input looks like this:




What is neat about this is that I wanted to conditionally only change the case of the surname – this left the user’s initials intact and did not give me camel case which I wanted to avoid.

Please see here for more info.

Hope this helps!

Tagged , , , ,
Collaboration Engineer

All things Technology - Posts to save for when you need them

Gerry Keleghan's Blog

A Blog about Cisco Unified Communications


my personal journey to ccie collaboration

Striving for greatness

Thoughts on DevOps, emerging tech, and open source

Network Experts Blog

“Knowledge comes by eyes always open and working hands.”

SIP Adventures

A unified communications blog by Andrew Prokop

The Cloverhound Blog

Cloverhound Employees Talk Unified Communications and Contact Center


Fog navigator. Get out of the clouds. Down to earth solutions. @Warcop

Cisco Collab Engineering Tips

Michael White - CCIE #26626


Photography by Manos,


Thoughts and experiences of a Cisco Collaboration engineer after clearing the CCIE lab...

The Daily Post

The Art and Craft of Blogging

The WordPress.com Blog

The latest news on WordPress.com and the WordPress community.

%d bloggers like this: