Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Regex has been one of the most requested features in Qlik Sense for years, and now it’s finally here.
With this year's May 2025 release, Qlik added native support for regular expressions in both load scripts and chart expressions. That means you can validate formats, extract values, clean up messy text, and more, all without complex string logic or external preprocessing.
In this post, we’ll look at what’s new, how it compares to the old workarounds, and a practical example you can plug into your own app.
Regex (short for Regular Expression) is a compact way to define text patterns. If you’ve used it in Python, JavaScript, or other programming languages, the concept will feel familiar.
Qlik now includes native support for regular expressions with functions that work in load scripts and chart expressions:
MatchRegEx() – check if a value matches a pattern
ExtractRegEx() – extract the first substring that matches
ReplaceRegEx() – search and replace based on a pattern
SubFieldRegEx() – split text using regex as the delimiter
There are also group-based versions (ExtractRegExGroup, etc.), case-insensitive variants (MatchRegExI), and helpers like CountRegEx() and IsRegEx().
Here's where regex saves time:
Pattern-based replacements: Clean or reformat values without chaining multiple functions.
With regex:
If(MatchRegEx(Code, '^[A-Z]{2}-\d{5}$'), 'Valid', 'Invalid') // check format
ExtractRegEx(Text, '\d{5}') // get first 5-digit number
ReplaceRegEx(Field, '\D', '') // strip non-digits
Cleaner logic. Fewer steps. Easier to maintain.
If any of the following sound familiar, regex will help:
Format checks: postal codes, product SKUs, ID numbers.
Data extraction: get domain from email, number from notes, etc.
PII masking: hide parts of a SSN or credit card.
String cleanup: strip unwanted characters, normalize spacing.
Splitting tricky fields: CSV lines with quoted commas, mixed delimiters.
Keep in mind that these functions can be used directly in chart expression, so you can build visuals or filters based on pattern logic, not just static values.
Let’s say you’ve got a bunch of phone numbers like this:
(312) 678-4412
312-678-4412
3126784412
123-678-4412 // invalid: area code starts with 1
312-045-4412 // invalid: exchange starts with 0
312-678-441 // invalid: too short
You want to:
Validate that it’s a proper 10-digit North American number
Standardize the format to (###) ###-####
Here’s how to do it with regex in your load script:
LOAD
RawPhone,
// 1. Strip out anything that's not a digit
ReplaceRegEx(RawPhone, '\D', '') as DigitsOnly,
// 2. Validate: 10 digits exactly, starting with 2–9
If(MatchRegEx(RawPhone, '^\(?[2-9]\d{2}\)?[-.\s]?\d{3}[-.\s]?\d{4}$'),
'Valid', 'Invalid') as Status,
// 3. Standardize format to (###) ###-####
ReplaceRegEx(
ReplaceRegEx(RawPhone, '\D', ''),
'(\d{3})(\d{3})(\d{4})',
'(\1) \2-\3'
) as FormattedPhone
INLINE [
RawPhone
3025557890
(404) 222-8800
678.333.1010
213 888 9999
1035559999
678-00-0000
55577
];
Result:
One pattern replaces multiple conditions and formatting is consistent. This is much easier to maintain and easy to expand if the rules change.
Not sure how to write the pattern?
Tools like regex101.com or regexr.com are great for testing and adjusting before you build in Qlik.
With native regex in Qlik Sense, you can now clean, validate, extract, and transform text with precision without convoluted scripts or third-party tools. It’s a quiet but powerful upgrade that unlocks a ton of flexibility for real-world data.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.