I am using javascript and looking for a regex which can replace a matched string with the same number of space. For example, I want to match a string which begins with `show` and ends to the end of line, this is the regex I am using `/show .*$/`. If users type `show dbs` then I want to replace with  (8 spaces). How can I know the number of characters for the matched string?