Test, validate and match regular expressions
This regex validates sed-style substitution expressions such as s/pattern/replacement/g. It captures an arbitrary delimiter character (any single char after 's'), matches the search and replacement strings while allowing backslash-escaped delimiters (via negative lookbehind and escaped-backslash handling), and optionally accepts modifier flags (g, i, m, s, x, r) anchored at the end. Useful for parsing replace commands in text processors, bot command handlers, or script interpreters.