the 'g' is unnecessary as the pattern you're giving should start at the beginning of the string and consume the whole string, I believe. If it shouldn't consume the whole string, you'd be better off add '.*' after ```+ from``` and removing the 'g'. As far as the code is concerned, you don't care what occurs before ```from``` (it's all optional). Also, since replacer is not using what comes before 'from', change to non-capturing groups ```(?:pattern)?``` and remove p1 and p2 from the arg list: ```(?:https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}(?:[-a-zA-Z0-9@:%_\+.~#?&//=]*))?```