And here you may use capturing group, look-ahead or at least slices. Definitely not stripping `%` down the line, regexes are good at obtaining precisely what you want.