Try the following block
Code: Select all
/L17"PowerShell" Nocase EnableMLS Line Comment = # Block Comment On = <# Block Comment Off = #> String Chars = "' Escape Char = ` EnableSpellasYouType File Extensions = PS1 PSM1 PSD1
/Colors = 0,2255900,2255900,8421504,1580487,
/Colors Back = 16777215,16777215,16777215,16777215,16777215,
/Colors Auto Back = 1,1,1,1,1,
/Font Style = 0,0,0,0,0,
/Delimiters = # ( ),:;[]{}
/Indent Strings = "{" "if" "else" ":"
/Unindent Strings = "}"
/Function String = "%[^t ]++^{filter^}^{function^}[^t ]+^([a-z0-9_^-]+^)"
/Open Brace Strings = "{" "(" "["
/Close Brace Strings = "}" ")" "]"
/Open Fold Strings = "{" "("
/Close Fold Strings = "}" ")"
/Open Comment Fold Strings = "region"
/Close Comment Fold Strings = "endregion"
Note: The multiple spaces between
( and
) must be replaced after pasting this block into the wordfile by a single horizontal tab character. Browsers display a tab character in a preformatted text as a sequence of spaces according to HTML standard.
If the PowerShell script files now contain
region and
endregion (without a space) within a comment in any case, UltraEdit offers to fold the block between
region and
endregion. I have verified that with UE v21.00.0.1033 and an example file named Test.ps1.
Mistakes in your original block:
EnableSpellasYouType was appended at end of first line and therefore interpreted as file extension. After
File Extensions = nothing else than file extensions can be listed.
File extensions are always not case-sensitive. Therefore it is enough to specify them only in upper case or only in lower case.
Line Comment Alt = # was a useless double definition of a line comment.
It is only possible to specify 1 escape character for a single or a double quote in a single or double quoted string. I kept
` and removed
\ as I don't know which escape character is more often used in PowerShell script files.
# added to list of word delimiting characters as I have suggested in my previous post. The list of delimiters is additionally sorted according to ASCII list with the exception of the space and the tab character. The sort is not really necessary, but helps to see what is already in the list on longer lists than here.
The UltraEdit regular expression search for finding strings for the function list is executed always not case-sensitive. Therefore it is not necessary to use
[Ff] and
[a-zA-Z] as that makes just the regular expression longer.