I'm using replace to find special codes with regular expression and replace them with the substring modified.
// More stuff happens inside the function, but this was just simplified
x.replace(/start([a-f0-9]{16})end/g, function(code){return code;});
The codes always start and end the same way and they're pretty easy to match with regular expression. However, I'd like to only pass what's in the parentheses to the function. Is that possible?