This enhanced Regex Explainer:
Input:
`^` → start‑of‑string anchor
`(?:https?)` → non‑capturing group matching “http” or “https”
`://` → literal “://”
`([\w\-.]+)` → capturing group: one or more word‑chars, hyphens, or dots (the domain)
`/?` → optional slash
`$` → end‑of‑string anchor
Length | 23 |
---|---|
Capturing Groups | 1 |
Non‑capturing Groups | 1 |
Positive Lookahead | 0 |
Total Quantifiers | 3 |
`^` → start anchor | `$` → end anchor
`\d` → digit | `\w` → word char
`+` → one or more | `*` → zero or more
`?` → zero or one | `{n,m}` → range quantifier
`( )` → capturing | `(?: )` → non‑capturing
`(?= )` → lookahead | `(?<= )` → lookbehind
`|` → alternation | `.` → any char
– Audit complex patterns at a glance.
– Document regex in code reviews.
– Teach teammates without regex experience.