Skip to content

Documentation text and sample are inconsistent: parentheses around RegExp literals #9022

Closed
@alecglassford

Description

@alecglassford

Describe the bug

On https://svelte.dev/docs/basic-markup#text-expressions (source markdown), there is an aside that reads:

If you're using a regular expression (RegExp) literal notation, you'll need to wrap it in parentheses.

This is followed by a markup sample:

<div>{/^[A-Za-z ]+$/.test(value) ? x : y}</div>

Note that in the sample, the RegExp literal is not wrapped in parentheses. Therefore this section of the doc becomes confusing to users: do you need to wrap RegExp literals in parentheses or not?

Reproduction

Navigate to https://svelte.dev/docs/basic-markup#text-expressions

Logs

N/A

System Info

N/A

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions