Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add ErrorMessage parameter to ValidatePatternAttribute #2719

Copy link
Copy link
@powercode

Description

@powercode
Issue body actions

The errors provided when a parameter validates a [ValidatePattern("somehorribleregex")] is hard to interpret for the user.

It would be useful to be able to provide a human readable error message when the validation fails. Regexs are powerful, but not readable.

Any yes, even if localization may be an issue, it is still better than the regex. :)

param(
[ValidatePattern('[A-Z]:',  ErrorMessage='The Drive should be specified as a single letter followed by a colon, for example "D:"')]
[string] $Drive,

[ValidatePattern('\\\\\w+\\\w+',  ErrorMessage='The NetworkShare should be specified on the following format: "\\computer\sharename"')]
[string] $NetworkShare
)

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.