You may be having trouble with using regex and links in twig/php!
Generally, You'd want to escape a slash!
would look something like this in js:
/ === delimiter
\/ === escaped slash
This doesn't play nicely with twig!
I figure twig is trying to be smart and escape things for you.
but I'm not really sure whats going on.
(Thankfully, php provides a way to work around this issue.)[https://www.php.net/manual/en/regexp.reference.delimiters.php]
All of the above delimiters are valid!
This means, if we take our URL:
We just need to wrap it with a delimiter which isn't used in the string.
That's it! The regex should work how you'd like it to.
Regex is weird.
Twigs undocumented behavior is weird.
together they're an afternoon of frustration.