|
| 1 | +$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' |
| 2 | +$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path |
| 3 | + |
| 4 | +Write-RegEx -Description "Matches a Cron interval" | |
| 5 | + Write-RegEx -Pattern @' |
| 6 | +(?> |
| 7 | + (?<Any>\*) # An asterisk |
| 8 | + | # or |
| 9 | + (?<Start> |
| 10 | + (?>[0-5][0-9]|[0-4]\d|\d{1,1}) # A number between 0 and 59 |
| 11 | + ) |
| 12 | + (?<End> |
| 13 | + \- # a dash |
| 14 | + (?>[0-5][0-9]|[0-4]\d|\d{1,1}) # followed by another number between 0 and 59 |
| 15 | + ){0,1} |
| 16 | + (?<Or>\,){0,1} # followed by an optional comma (which indicates 'or') |
| 17 | +) |
| 18 | +'@ -Name Minute -Min 1 | |
| 19 | + Write-RegEx -CharacterClass Whitespace -Comment "# A space" | |
| 20 | + Write-RegEx -Pattern @' |
| 21 | +(?> |
| 22 | + (?<Any>\*) # An asterisk |
| 23 | + | # or |
| 24 | + (?<Start> |
| 25 | + (?>[0-2][0-3]|[0-1]\d|\d{1,1}) # A number between 0 and 23 |
| 26 | + ) |
| 27 | + (?<End> |
| 28 | + \- # a dash |
| 29 | + (?>[0-2][0-3]|[0-1]\d|\d{1,1}) # followed by another number between 0 and 23 |
| 30 | + ){0,1} |
| 31 | + (?<Or>\,){0,1} # followed by an optional comma (which indicates 'or') |
| 32 | +) |
| 33 | +'@ -Name Hour -Min 1 | |
| 34 | + Write-RegEx -CharacterClass Whitespace -Comment "# A space" | |
| 35 | + Write-RegEx -Pattern @' |
| 36 | +(?> |
| 37 | + (?<Any>\*) # An asterisk |
| 38 | + | # or |
| 39 | + (?<Start> |
| 40 | + (?>3[0-1]|[0-2][1-9]|[1-9]) # A number between 1 and 31 |
| 41 | + ) |
| 42 | + (?<End> |
| 43 | + \- # a dash |
| 44 | + (?>3[0-1]|[0-2][1-9]|[1-9]) # followed by another number between 1 and 31 |
| 45 | + ){0,1} |
| 46 | + (?<Or>\,){0,1} # followed by an optional comma (which indicates 'or') |
| 47 | +) |
| 48 | +'@ -Name Day -Min 1 | |
| 49 | + Write-RegEx -CharacterClass Whitespace -Comment "# A space" | |
| 50 | + Write-RegEx -Pattern @' |
| 51 | +(?> |
| 52 | + (?<Any>\*) # An asterisk |
| 53 | + | # or |
| 54 | + (?<Start> |
| 55 | + (?>1[0-2]|[1-9]) # A number between 1 and 12 |
| 56 | + ) |
| 57 | + (?<End> |
| 58 | + \- # a dash |
| 59 | + (?>1[0-2]|[1-9]) # followed by another number between 1 and 12 |
| 60 | + ){0,1} |
| 61 | + (?<Or>\,){0,1} # followed by an optional comma (which indicates 'or') |
| 62 | +) |
| 63 | +'@ -Name Month -Min 1 | |
| 64 | + Write-RegEx -CharacterClass Whitespace -Comment "# A space" | |
| 65 | + Write-RegEx -Pattern @' |
| 66 | +(?> |
| 67 | + (?<Any>\*) # An asterisk |
| 68 | + | # or |
| 69 | + (?<Start> |
| 70 | + (?>[0-6]) # A number between 0 and 6 |
| 71 | + ) |
| 72 | + (?<End> |
| 73 | + \- # a dash |
| 74 | + (?>[0-6]) # followed by another number between 0 and 6 |
| 75 | + ){0,1} |
| 76 | + (?<Or>\,){0,1} # followed by an optional comma (which indicates 'or') |
| 77 | +) |
| 78 | +'@ -Name DayOfWeek -Min 1 | |
| 79 | + Set-Content -Path (Join-Path $myRoot $myName) -PassThru |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
0 commit comments