Browser-based search highlighting (with regex)

Share interesting information or links related to portable apps here.
Post Reply
Message
Author
User avatar
webfork
Posts: 10108
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

Browser-based search highlighting (with regex)

#1 Post by webfork » Sat Jan 16, 2021 3:21 pm

[Moderator note: this thread was split from the Recommended standard Windows/Office tweaks thread.]

---

This was previously addressed using (poorly) using either (well) using conversion to PDF and then PDF XChange Editor or Acrobat (poorly), but neither supports regex.

EDIT: The following search mechanism breaks down after about 500 characters, which isn't surprising or strange, I just got a little spoiled with PDF XChange allowing what seems to allow huge 1,000+ search terms. It also doesn't support case sensitivity at the moment.

---

Problem: Microsoft doesn't have a great relationship with Regular Expressions and Office Wildcards are just not as mature. There are some excellent regex-capable browser plugins that could function but refuse to work on files I drag into the browser (local webpages), as well as a surprising number of websites.

Solution: I setup a local webserver (I got the idea from these folks: https://github.com/presenta-software/pr ... starterkit) and have enabled regular expressions search that also enables multi-color highlighting.

Caveats
  • Not lightweight, requiring two browsers and some initial tweaks. This is admittedly convoluted, but I'm just thrilled to find some basic solution I've been chasing for over a year.
  • Search only (no replace yet).
  • Tested in Windows only, but it might well be cross-platform capable with some tweaks.
  • Requires Chrome - I recognize this thread (that I started) is Microsoft-focused, but since Chrome is almost ubiquitous now, your probably have access to that software.
Steps:

1. Open Edge or Firefox (Chrome might work fine too, untested) and install Multiple Search and Highlight https://add0n.com/multiple-highlight.html
2. Open Chrome and install (and then run) the local webserver app https://chrome.google.com/webstore/deta ... hemlocgigb
3. Point the webserver to a local folder -- I saved it to c:\temp\webserv and createdan index.html. I bookmarked the localhost location:

Code: Select all

http://127.0.0.1:8887/
4. Because closing the pop-up window closes the program and I avoid use Chrome, I setup a batch file for the internal launcher so I can pull it up quickly:

Code: Select all

start "" "C:\Program Files(x86)\Google\Chrome\Application\chrome.exe" https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb/related
I then open the index page in an editor of choice (I like LibreOffice but you can also use MS Word) add whatever text I want to analyze, and then run my analysis. Or just replace whatever local web page with the index.html file and reload.

Result:

Image

--

As always, feedback welcome.
Last edited by webfork on Sat Jan 16, 2021 3:26 pm, edited 1 time in total.

User avatar
webfork
Posts: 10108
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

Re: Browser-based search highlighting (with regex)

#2 Post by webfork » Sun Nov 21, 2021 8:10 pm

I recently figured out a way to do something similar to the above process, but with LibreOffice, but also enable multiple different highlights and of course the text can be edited, unlike browser driven highlights. In this case, I pressed CTRL+H, put in the following:

Code: Select all

and|with|other


... and clicked Find All

Image

To maintain the highlight even after you close the Find and Replace window, set the "Replace" field to include "&". If you modify the formatting to include highlighting you can replace everything with highlighted text (as below):

Image

I combined that with some other words and phrases into another color to get all sorts of good highlights:

Image

Making lists of problematic or concerning words stick out in a document is a huge time saver for me in a review process. This is going to save me a lot of headaches.

Post Reply