Adding RegEx Search and Replace to an Existing Chrome Bookmark Manager Script


I have not done any JS coding before but I got this working OK:

and was also able to get the DevTools debugger working with it as well. The question I have for the experienced Devs is: “How difficult would it be to add a RegEx search and replace facility to the script?”.


To answer your question literally, not that hard - probably less than 10 lines of code. JavaScript has a few one-command methods that deal with search/replace via regex:

The problem is that because (it looks like) it’s an extension, it would be a bit of a pain to develop as the workflow for developing plugins is much more involved than simply refreshing the page after saving changes. On line 36 of popup.js, you could probably change anchor.text(bookmarkNode.title); to anchor.text(bookmarkNode.title.replace('REGEX_FIND', 'REPLACE_STRING'));

Unfortunately I don’t have much bandwidth right now, but that might be a good place to start. You’d need to implement a way to get REGEX_FIND and REPLACE_STRING from the user, but that’s could be just a line or two


@tensormonkey ,

Thanks for responding! - I appreciate it.

I will have a look at that.

Yes, I looked at a lot of debugging stuff but there was not much for dealing with extensions but I think I have made some progress . .

OK, will look at that too.

OK, it sounds like it should be doable even if it is my first modification of someone else’s (simple) script - I might play around with search and replace in page first and see how I go there first.



1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.