File tree Expand file tree Collapse file tree 1 file changed +50
-3
lines changed
Expand file tree Collapse file tree 1 file changed +50
-3
lines changed Original file line number Diff line number Diff line change 11This directory and it's subdirectories contain syntax changes that enable common programming scenarios in PowerShell and PipeScript.
22
33
4- | DisplayName | Synopsis |
5- | ------------------------------------| ----------------------------------------------------- |
6- | [ RegexLiteral] ( RegexLiteral.psx.ps1 ) | [ Regex Literal Transpiler< br /> ] ( RegexLiteral.psx.ps1 ) |
4+ | DisplayName | Synopsis |
5+ | ------------------------------------| ------------------------------------------------|
6+ | [ RegexLiteral] ( RegexLiteral.psx.ps1 ) | [ Regex Literal Transpiler] ( RegexLiteral.psx.ps1 ) |
77
88
99
1010
11+ ## RegexLiteral Example 1
1112
1213
14+ ~~~ PowerShell
15+ {
16+ '/[a|b]/'
17+ } | .>PipeScript
18+ ~~~
19+
20+ ## RegexLiteral Example 2
21+
22+
23+ ~~~ PowerShell
24+ {
25+ "/[$a|$b]/"
26+ } | .>PipeScript
27+ ~~~
28+
29+ ## RegexLiteral Example 3
30+
31+
32+ ~~~ PowerShell
33+ {@'
34+ /
35+ # Heredocs Regex literals will have IgnorePatternWhitespace by default, which allows comments
36+ ^ # Match the string start
37+ (?<indent>\s{0,1})
38+ /
39+ '@
40+ } | .>PipeScript
41+ ~~~
42+
43+ ## RegexLiteral Example 4
44+
45+
46+ ~~~ PowerShell
47+ {
48+ $Keywords = "looking", "for", "these", "words"
49+ @"
50+ /
51+ # Double quoted heredocs can still contain variables
52+ [\s\p{P}]{0,1} # Whitespace or punctuation
53+ $($Keywords -join '|') # followed by keywords
54+ [\s\p{P}]{0,1} # followed by whitespace or punctuation
55+ /
56+ "@
57+ } | .>PipeScript
58+ ~~~
59+
You can’t perform that action at this time.
0 commit comments