Skip to main content Svelte Highlight v7.21.1

Regular expression language preview

1. Named groups and quantifiers

a date pattern with named capture groups
horizon-dark
^(?<year>\d{4})-(?<month>\d{2})-\d{2}\s+#\s*optional comment
atom-one-dark
^(?<year>\d{4})-(?<month>\d{2})-\d{2}\s+#\s*optional comment
github-dark
^(?<year>\d{4})-(?<month>\d{2})-\d{2}\s+#\s*optional comment
dracula
^(?<year>\d{4})-(?<month>\d{2})-\d{2}\s+#\s*optional comment
nord
^(?<year>\d{4})-(?<month>\d{2})-\d{2}\s+#\s*optional comment
github
^(?<year>\d{4})-(?<month>\d{2})-\d{2}\s+#\s*optional comment

2. Character classes and Unicode properties

POSIX classes, ranges, and \p{...} escapes
horizon-dark
(?:https?|ftp):\/\/[\w.-]+\.[a-z]{2,}
[[:alpha:]]+\d*\.?\p{L}*
atom-one-dark
(?:https?|ftp):\/\/[\w.-]+\.[a-z]{2,}
[[:alpha:]]+\d*\.?\p{L}*
github-dark
(?:https?|ftp):\/\/[\w.-]+\.[a-z]{2,}
[[:alpha:]]+\d*\.?\p{L}*
dracula
(?:https?|ftp):\/\/[\w.-]+\.[a-z]{2,}
[[:alpha:]]+\d*\.?\p{L}*
nord
(?:https?|ftp):\/\/[\w.-]+\.[a-z]{2,}
[[:alpha:]]+\d*\.?\p{L}*
github
(?:https?|ftp):\/\/[\w.-]+\.[a-z]{2,}
[[:alpha:]]+\d*\.?\p{L}*

3. Lookaround and backreferences

lookahead/lookbehind assertions, inline comments, and \k<name>
horizon-dark
(?=foo)(?<=bar)(?!baz)(?<!qux)
(?#inline comment)\k<year>\1
atom-one-dark
(?=foo)(?<=bar)(?!baz)(?<!qux)
(?#inline comment)\k<year>\1
github-dark
(?=foo)(?<=bar)(?!baz)(?<!qux)
(?#inline comment)\k<year>\1
dracula
(?=foo)(?<=bar)(?!baz)(?<!qux)
(?#inline comment)\k<year>\1
nord
(?=foo)(?<=bar)(?!baz)(?<!qux)
(?#inline comment)\k<year>\1
github
(?=foo)(?<=bar)(?!baz)(?<!qux)
(?#inline comment)\k<year>\1