Last active
June 16, 2023 07:46
-
-
Save Hugoberry/4948d96b45d6799c47b4b9fa1b08eadf to your computer and use it in GitHub Desktop.
Power Query regex example from http://www.thebiccountant.com/2018/04/25/regex-in-power-bi-and-power-query-in-excel-with-java-script/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
fx=(x,y)=> | |
Web.Page( | |
"<script> | |
var x="&x&"; | |
var y=new RegExp('"&y&"','g'); | |
var b=x.match(y); | |
document.write(b); | |
</script>")[Data]{0}[Children]{0}[Children]{1}[Text]{0} | |
in | |
fx("""hello012中国1235""","\\d+") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My take on the snippet, ready to paste to as new query:
basically it's the same, it's only easier to use if you don't know power query :)
edit: check the performance of this solution, I think this it is super slow for bigger data.