@@ -1442,7 +1442,70 @@ Unpins the specified message.
1442
1442
1443
1443
---
1444
1444
1445
- ## Role functions
1445
+ ## Regex Functions
1446
+
1447
+ #### reFind
1448
+
1449
+ ``` yag
1450
+ {{ $result := reFind <regex> <text> }}
1451
+ ```
1452
+
1453
+ Returns the first match of the regular expression ` regex ` in ` text ` , or the empty string if the pattern did not match
1454
+ anywhere.
1455
+
1456
+ #### reFindAll
1457
+
1458
+ ``` yag
1459
+ {{ $result := reFindAll <regex> <text> [count] }}
1460
+ ```
1461
+
1462
+ Returns a slice of successive matches of ` regex ` in ` text ` . If ` count ` is provided, the number of matches is limited to
1463
+ that amount; otherwise, all matches are returned.
1464
+
1465
+ #### reFindAllSubmatches
1466
+
1467
+ ``` yag
1468
+ {{ $result := reFindAllSubmatches <regex> <text> [count] }}
1469
+ ```
1470
+
1471
+ Returns a slice of successive submatches of ` regex ` in ` text ` . Each submatch is itself a slice containing the match of
1472
+ the entire expression, followed by any matches of capturing groups. If ` count ` is provided, the number of submatches is
1473
+ limited to that amount; otherwise, all submatches are returned.
1474
+
1475
+ #### reQuoteMeta
1476
+
1477
+ ``` yag
1478
+ {{ $result := reQuoteMeta <string> }}
1479
+ ```
1480
+
1481
+ Escapes all regular expression metacharacters in the input ` string ` ; the result is a regular expression matching the
1482
+ literal input string.
1483
+
1484
+ #### reReplace
1485
+
1486
+ ``` yag
1487
+ {{ $result := reReplace <regex> <text> <replacement> }}
1488
+ ```
1489
+
1490
+ Replaces all matches of ` regex ` in ` text ` with ` replacement ` .
1491
+
1492
+ #### reSplit
1493
+
1494
+ ``` yag
1495
+ {{ $result := reSplit <regex> <text> [count] }}
1496
+ ```
1497
+
1498
+ Splits the ` text ` around each match of ` regex ` , returning a slice of delimited substrings.
1499
+
1500
+ if the ` count ` parameter is specified, it limits the number of substrings to return:
1501
+
1502
+ - ` count > 0 ` : at most ` count ` substrings; the last substring will be the unsplit remainder;
1503
+ - ` count == 0 ` : the result is ` nil ` (zero substrings);
1504
+ - ` count < 0 ` : all substrings.
1505
+
1506
+ ---
1507
+
1508
+ ## Role Functions
1446
1509
1447
1510
#### addRole
1448
1511
@@ -1667,7 +1730,7 @@ Reports whether the specified target has the specified role name (case-insensiti
1667
1730
1668
1731
---
1669
1732
1670
- ## String manipulation
1733
+ ## String Manipulation
1671
1734
1672
1735
{{< callout context="note" title="Note: RegEx Limitations" icon="outline/info-circle" >}}
1673
1736
@@ -1741,65 +1804,6 @@ the end.
1741
1804
1742
1805
Interpolates ` args... ` according to ` format ` . See the [ Go ` fmt ` package documentation] ( https://pkg.go.dev/fmt ) .
1743
1806
1744
- #### reFind
1745
-
1746
- ``` yag
1747
- {{ $result := reFind <regex> <text> }}
1748
- ```
1749
-
1750
- Returns the first match of the regular expression ` regex ` in ` text ` , or the empty string if the pattern did not match
1751
- anywhere.
1752
-
1753
- #### reFindAll
1754
-
1755
- ``` yag
1756
- {{ $result := reFindAll <regex> <text> [count] }}
1757
- ```
1758
-
1759
- Returns a slice of successive matches of ` regex ` in ` text ` . If ` count ` is provided, the number of matches is limited to
1760
- that amount; otherwise, all matches are returned.
1761
-
1762
- #### reFindAllSubmatches
1763
-
1764
- ``` yag
1765
- {{ $result := reFindAllSubmatches <regex> <text> [count] }}
1766
- ```
1767
-
1768
- Returns a slice of successive submatches of ` regex ` in ` text ` . Each submatch is itself a slice containing the match of
1769
- the entire expression, followed by any matches of capturing groups. If ` count ` is provided, the number of submatches is
1770
- limited to that amount; otherwise, all submatches are returned.
1771
-
1772
- #### reQuoteMeta
1773
-
1774
- ``` yag
1775
- {{ $result := reQuoteMeta <string> }}
1776
- ```
1777
-
1778
- Escapes all regular expression metacharacters in the input ` string ` ; the result is a regular expression matching the
1779
- literal input string.
1780
-
1781
- #### reReplace
1782
-
1783
- ``` yag
1784
- {{ $result := reReplace <regex> <text> <replacement> }}
1785
- ```
1786
-
1787
- Replaces all matches of ` regex ` in ` text ` with ` replacement ` .
1788
-
1789
- #### reSplit
1790
-
1791
- ``` yag
1792
- {{ $result := reSplit <regex> <text> [count] }}
1793
- ```
1794
-
1795
- Splits the ` text ` around each match of ` regex ` , returning a slice of delimited substrings.
1796
-
1797
- if the ` count ` parameter is specified, it limits the number of substrings to return:
1798
-
1799
- - ` count > 0 ` : at most ` count ` substrings; the last substring will be the unsplit remainder;
1800
- - ` count == 0 ` : the result is ` nil ` (zero substrings);
1801
- - ` count < 0 ` : all substrings.
1802
-
1803
1807
#### sanitizeText
1804
1808
1805
1809
``` yag
@@ -1998,7 +2002,7 @@ can be done using the `print` function:
1998
2002
1999
2003
---
2000
2004
2001
- ## Type conversion
2005
+ ## Type Conversion
2002
2006
2003
2007
#### structToSdict
2004
2008
0 commit comments