Forum Discussion
Extract six-digit numbers from text string
- Anonymous2 years ago
Hi Anonymous ,
You can use this regular expression:
let str = ""; let regex = ^[0-9]{6}$; let match = str.match(regex); if (match) { console.log(match); }If this expression still doesn't work with your data you can use this link to automatically generate a regular expression.
You can refer to the following documents to learn how to use regular expressions in power query:
Regular expressions in Power Query – Q-stat
Using regular expressions in power bi desktop - Microsoft Fabric Community
Using Regular Expressions(RegEx) in Power BI | by Shivam Shukla | Medium
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If "REQUEST-" always preceeds the numbers, you could split the column on that, then split the result on " submitted." to remove the text from the end.
If you're trying to use it as a filter or relationship, though, you'll want to split the request numbers "to new rows" on the comma at the end of it all.
Unfortunately, "REQUEST" does not always precede the request number(s). I just updated my original post to reflect that.
Thanks for replying!