Skip to content

@pattern regex does not work with literal spaces in it #1857

Description

@lobabob

If you do a regex like this: /^[a-zA-Z0-9 ]*$/ tsoa will give you an Invalid regular expression: /^[a-zA-Z0-9/: Unterminated character class SyntaxError at runtime.

Pretty sure this is because @pattern looks for a space to separate the regex and the error message. Which means the rest of the regex after the space gets cut off and treated as part of the error message.

I understand you can /s to match whitespace as an alternative, but I'm talking about the case of matching a literal space character only where you don't want to match all whitespace characters.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions