This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Hi,
I have a table containing Postal code and the regex pattern this postal code should follow to be correct.
What I want is a new column saying if the Postal code is matching the Pattern provided in the same row or now. With a simple TRUE/FALSE statement.
Currently I have tested this script in "R Script":
isMatch <- function(x,y) {grepl(y, as.character(x), ignore.case=TRUE)}
return <- within(dataset,{Flag=isMatch(dataset$Zip, dataset$Pattern)})
But as you can see, none of the records are matching.
Any suggestion on how to do this would be very helpful. Don't have to be in R Script 🙂
I will have a full table of 200k Postal codes coming up soon.
Thanks!
Hi @Anonymous ,
You can refer these two articles which introduce regular expression in details in power query, hopes it could help.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Thanks, but these are reffering to manually input of the pattern. This is working if you are focusing on only a few patterns, not when you have 200+ patterns. 😞
@Anonymous , refer if this power query M code can help
https://www.excel-university.com/power-query-and-zip-code-formatting/
Also check - https://www.youtube.com/watch?v=jCsA9e4BRdw
Hi,
Thanks, but this is not what I was after.
I am not after to format the Postal codes, I want to check if they are in the correct format according to Universal Postal Union.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 37 | |
| 32 | |
| 27 | |
| 24 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 50 | |
| 31 | |
| 26 | |
| 24 |