Browser-based search highlighting (with regex)
Posted: 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
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:
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:
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:
--
As always, feedback welcome.
---
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.
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/
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
Result:
--
As always, feedback welcome.