Skip to content

New-RegEx: -NotCharacterClass, -NotLiteralCharacter #104

@StartAutomating

Description

@StartAutomating

Is your feature request related to a problem? Please describe.

Regex character class subtraction is annoying.

New-Regex should include something to abstract it.

Describe the solution you'd like

New-Regex should add -NotCharacterClass and -NotLiteralCharacter.

Without additional parameters, these should act like -CharacterClass and -LiteralCharacter, except that the selection set should be prefixed with ^ (to indicate that it is not those characters)

When provided with -CharacterClass or -LiteralCharacter, these should create a character class subtraction.

# Match anything but punctuation
New-RegEx -NotCharacterClass Punctuation 

# Match any punctuation except open/close/quote/endquote, and comma.
New-RegEx -CharacterClass Punctuation -NotCharacterClass PunctuationOpen, PunctuationClose, PunctuationInitialQuote, PunctuationFinalQuote -NotLiteralCharacter ','  

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions