Home

Welcome to MidnightDBA.com!

Here is the place we put our free technology tutorials. We cover various aspects of SQL Server and PowerShell, and whatever else strikes our fancy. You’ll also find recordings of our classes – we speak at user groups and conferences internationally – and of our live weekly IT webshow, DBAs@Midnight. As long as you’re here, check out our blogs, and our other sites: we review books and products on ITBookworm.com, and we offer our career workshop for sale at DBARoadmap.com

Regex Word Boundary Example

It’s one thing to know the syntax for word boundaries in regex and it’s another to actually be able to use them. So here I’m showing you a simple example where using a beginning word boundary can come in quite handy. If you don’t know the basics of word boundaries, then watch my other vid where I show you what they’re all about.

What we’re doing here is we’re adding something to the beginning of each word. We’re turning regular column names into variables and using word boundaries is a perfect way to do this. There are other ways we could go about it, but this is a great regex word boundary example that’ll show you how to work with word boundaries in a simple way that’ll be useful to you immediately.
Now, in the example in the video, I actually could get away w/o using the word boundary. The data is simple enough that it could be done. But I took this opportunity to show you how you would use it with a word boundary to help you realize the types of things that can be done. So really the word boundary in this example is there to more ensure that you’re only taking word characters that are at the beginning of the word. And what you’ll end up with is protecting against not picking up column names that have non-word characters in the name. And as long as they don’t start with a non-word character you’ll be good.
Again, this isn’t meant to be a complete solution, but more a simple example meant to show you where this feature can be useful.

If you don’t understand the basics of regex word boundaries, you can see that vid here:

Regex Word Boundaries

► Watch more

Looking for remote DBAs? We can handle your every need. Check us out at MidnightSQL.

Latest videos

Regex Word Boundary Example

It’s one thing to know the syntax for word boundaries in regex and it’s another to actually be able...

Read More

Regex Word Boundaries

Here I’m going to show you how to use regex word boundaries. Word boundaries allow you to match entire...

Read More

Regex Lookarounds

In regex you can perform lookarounds to check for matches that don’t get consumed. These are zero-length assertions that...

Read More

Find double words in regex

Here I show you how to use a backreference in regex to be able to find double words in...

Read More

Find Log Space Used

Find out how to query the log space usage for all DBs on the server with a single statement....

Read More