You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Documentation.Description = "A generic regular expression replacement function based on the Javascript replace() method. Adapted from https://www.thebiccountant.com/2018/04/25/regex-in-power-bi-and-power-query-in-excel-with-java-script/. #(lf)See https://www.w3schools.com/jsref/jsref_obj_regexp.asp for Javascript regular expression reference and https://www.regular-expressions.info/ for general regular expression information.",
60
+
Documentation.Examples = {
61
+
[
62
+
Description = "Pattern without capturing groups",
63
+
Code = "RegexReplace(""The quick brown fox jumps over the lazy dog"", ""the quick brown fox"",""Da fox"",""i"")",
64
+
Result = "Da fox jumps over the lazy dog"""
65
+
],
66
+
[
67
+
Description = "Pattern that does not match",
68
+
Code = "RegexReplace(""The quick brown fox jumps over the lazy dog"", ""the quick brown fox"",""Da fox"")",
69
+
Result = "The quick brown fox jumps over the lazy dog"
70
+
],
71
+
[
72
+
Description = "Pattern with capturing groups",
73
+
Code = "RegexReplace(""The quick brown fox jumps over the lazy dog"", ""the quick brown (.*?) jumps over the ([^ ]*) ([^ ]*)"", ""THE QUICK BROWN $1 JUMPS OVER THE $2 $3"", ""i"")",
74
+
Result = "THE QUICK BROWN fox JUMPS OVER THE lazy dog"
LoremIpsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eu laoreet turpis. Curabitur lacinia, risus ut rhoncus mattis, turpis lorem iaculis justo, nec ultrices arcu erat vitae felis. Pellentesque vulputate efficitur scelerisque. Etiam bibendum dignissim mauris",
8
+
*/
9
+
10
+
// calculate length of string *after* the rightmost newline
11
+
strNewline = "#(lf)",
12
+
Text_LengthAfterNewline = (string as text) as number =>
0 commit comments