Regular Expressions Regex modifiers (flags) Explicit Capture modifier


Example

This is a .NET regex specific modifier expressed with n. When used, unnamed groups (like (\d+)) are not captured. Only valid captures are explicitly named groups (e.g. (?<name> subexpression)).

(?n)(\d+)-(\w+)-(?<id>\w+)

will match the whole 123-1_abc-00098, but (\d+) and (\w+) won't create groups in the resulting match object. The only group will be ${id}. See demo.