Regex Search & Highlight

Search and highlight text using regex patterns on any webpage

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
JimDop
今日安裝
0
安裝總數
0
評價
0 0 0
版本
1.0
建立日期
2025-11-21
更新日期
2025-11-21
尺寸
10.8 KB
授權條款
MIT
腳本執行於
所有網站

I've created a robust Violentmonkey/Tampermonkey userscript with these features:
Key Features:

Regex search with full regex pattern support
Yellow highlighting of all matches
Match counter showing total matches found
Case sensitive toggle option
Whole word search option
Minimizable panel (stays out of your way)
Auto-scrolls to first match
Works on dynamic sites like Reddit and NYTimes (MutationObserver tracks DOM changes)
Smart text node filtering (skips scripts, styles, and the panel itself)

How to use:

Install Violentmonkey extension
Create a new script and paste this code
Visit any website
Enter a regex pattern (e.g., \b[A-Z]{3,}\b for acronyms, \d{3}-\d{3}-\d{4} for phone numbers)
Click "Search & Highlight"

Example patterns to try:

\b\w+@\w+\.\w+\b - Email addresses
https?://[^\s]+ - URLs
\$\d+\.?\d* - Dollar amounts
\b[A-Z][a-z]+\b - Capitalized words

The script handles complex pages by using TreeWalker to efficiently find text nodes and a MutationObserver to re-apply highlights when the page changes dynamically.