Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
428 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Some other pages relevant to these blogs include:
You can also book hourly online consultancy for your time zone with one of our 7 expert trainers!
|
Changes to SQL introduced in SQL Server 2025 Part one of a five-part series of blogs |
|---|
|
In addition to handling AI models, vectors of data and JSON, SQL now includes a number of other new functions and features (as this blog explains)
|
In this blog
If you are a fan of regular expressions, you'll be delighted to know that you can now incorporate them within SQL queries.
You can only use the new T-SQL regular expression functions within the latest database format (so compatibility level 170 or higher). One way to find out if you're using this is to run this query:
SELECT
d.name AS 'Database name',
d.compatibility_level AS 'Compatibility level'
FROM
sys.databases as d
ORDER BY
d.name
Here I should be able to use REGEX functions in all of my databases, as I've connected to a database in a SQL Server 2025 instance:

Databases 3 and 4 are ones I've created.
Suppose that you want to list all of the films in a database which might be sequels. A sequel can take various forms - here are examples of each:
Example film title | Test for |
|---|---|
Rocky II, Rocky III, Rocky IV | Films ending in II, V, VI or X (upper case only) |
Toy Story 2, Toy Story 3, Toy Story 4 | Films ending in a digit more than 1, preceded by a space |
Here is an example of a query which would show sequels, usig the new REGEXP_LIKE function (the "P" stands for "Pattern", apparently):
SELECT
f.Title,
g.Genre,
f.RunTimeMinutes
FROM
Film AS f
JOIN Genre AS g ON f.GenreID = g.GenreID
WHERE REGEXP_LIKE(
Title,
' [2-9]$|(V|X|II|VI)$'
)
Here are the first few films this would show:

I'm not sure if film number 3 (American History X) and 8 (Super 8) are genuinely sequels, but there's no algorithmic way to filter these out.
Here's what the regular expression bits are doing:
Part of regular expression | What it filters for |
|---|---|
' [2-9]$ | A space followed by any digit between 2 and 9 appearing at the end of the title |
| | Or (so either of the two critieria could be true) |
(V|X|II|VI)$ | The title ending in the letters V, X, II or VI |
The REGEXP_LIKE function has an optional third argument giving flags. The main one you can use is 'i' to remove case-sensitvity, but by default regular expressions in SQL are case-sensitive.
The new regular expression functions are as follows:
Function | What it does |
|---|---|
REGEXP_LIKE | Determines if text matches a regular expression pattern (as shown above by example) |
REGEXP_REPLACE | Replaces text where a given regex pattern is found |
REGEXP_SUBSTR | Extracts part of a string based on a regular expression pattern |
REGEXP_INSTR | Returns the starting or ending position of a matched substring |
REGEXP_COUNT | Returns the number of times a regular expression occurs within a string |
REGEXP_MATCHES | Returns a table of substrings matching a regular expression |
REGEXP_SPLIT_TO_TABLE | Splits a string into a table of substrings using the regex pattern as a delimiter |
You can see the full syntax of these functions at this Microsoft site, but most people will probably only need to use the first REGEXP_LIKE function to test if a string matches a regular expression pattern.
| Parts of this blog |
|---|
|
Some other pages relevant to these blogs include:
You can also book hourly online consultancy for your time zone with one of our 7 expert trainers!
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2025. All Rights Reserved.