Ouims, you are being pedantic again. It's not pretty.
For this user's purposes, there should be no noticeable or even practical loss of PC performance, while the user gains the flexibility of support for dynamically changing input.
In conducting performance speed tests (for a script, lol), on an 8 year old mid-grade Dell Optiplex, I conclude that the $remove and the $regex methods both execute in less than 1/10,000th of a second, with the $regex method being relatively slower but negligibly so. This also in part to requiring two lines of code for regex; one for the $regex() and one for the $regml(). I was still able to iterate 15,000 times without it taking one full second to complete.
regexspeedtest {
var %text = http://localhost/#access_token=THIS_IS_WHAT_I_NEED&scope=channel_read+channel_editor+channel_subscriptions+channel_check_subscription
var %i = 1, %ticks = $ticks
WHILE (%i <= 10000) {
inc %i
var %token = $remove(%text,http://localhost/#access_token=,&scope=channel_read+channel_editor+channel_subscriptions+channel_check_subscription)
noop $regex(%text,/access_token=([^&]+)/)
var %token = $regml(1)
}
echo -a $calc($ticks - %ticks) ms, %token
}
By alternately removing the lines of code not being tested, my repeatable speed results were such.
$remove = 488 ms @ 10,000 iterations
$regex = 691 ms @ 10,000 iterations
control = 213 ms @ 10,000 iterations
Adjusted for control, $remove took 275 ms, and $regex took 478 ms. Faster than it took to write this.