Aside from the obvious readability improvements (assuming well named/scoped functions of course), this also has the strong advantage of providing an abstraction point for the functionality.
Let's pretend you have 30 places in the code where want to use this functionality, and you do not put a function wrapper on it. Then, if that functionality needs to change, you need to find and change that in 30 places, which is very error prone (especially in JS, where refactoring tools are immature at best).
If that were in a function, you just change the contents of the function (one point code change) and the rest is isolated.
Perhaps your specific code in the question isn't the best example of how important this can be, but it's a very strong concept in general, IMNSHO. I don't use the word 'always' much, but I'd pretty close to always prefer a function wrapper for that abstraction point alone regardless of the added naming/organizational benefits.
Actually, your function is a decent example of my point. If you ever (for some reason which I can't fathom at the moment, but that's besides the point) wanted to change how you escape the string or get away from regex, you would have to only change that function body, not find every place you use RegEx.escape