Test, validate and match regular expressions
Matches a line starting with one or more identical characters, followed by any content (lazily captured in group 2), and ending with a run of identical trailing characters anchored at the line end. Replacing with $2 strips repeated characters like ---, ===, or *** from both ends of each line. Useful for cleaning up decorative borders, markdown-style underlines, or divider lines in multiline text. The m flag enables per-line processing, and i makes backreference matching case-insensitive.