firasdib / Regex101

This repository is currently only used for issue tracking for www.regex101.com
3.24k stars 199 forks source link

Include substitution in Match Information #1913

Closed juarezr closed 1 year ago

juarezr commented 1 year ago

Include substitution in Match Information

Currently, there is only one option controlling what results are displayed on the Match Information Panel:

Feature Request

Example

Given the match expression:

Regular Expression ([^-\n]+)\s+-\s+([^\n]+)(.mp3)
Test String I Still Haven't Found What I'm Looking For - U2.mp3
Substitution $3 - $1.mp3
Engine Java

Current Match Information:

Match 1 0-51 I Still Haven't Found What I'm Looking For - U2.mp3
Group 1 0-42 I Still Haven't Found What I'm Looking For
Group 2 45-47 U2

Improved Match Information:

Match 1 0-51 I Still Haven't Found What I'm Looking For - U2.mp3
Group 1 0-42 I Still Haven't Found What I'm Looking For
Group 2 45-47 U2
Substituion U2 - I Still Haven't Found What I'm Looking For.mp3
firasdib commented 1 year ago

The output of the substitution is shown in the substitution box. This is a separate action, and unrelated to the match box above. The substitution runs on the entire string and spits out a new string, there isn't really a notion of matches per se.