Created
August 22, 2022 20:45
-
-
Save Benjaminhu/3388b4112eb071bb27b12185b9ac232c to your computer and use it in GitHub Desktop.
JavaScript Bookmarklet: get unique sorted pattern list from current HTML page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// steps: | |
// 1. copy code (CTRL + A, CTRL + C) | |
// 2. go to: http://subsimple.com/bookmarklets/jsbuilder.htm | |
// 3. paste code after: "javascript:" | |
// 4. [optional] customize "pattern" | |
// 5. add name | |
// 6. push "(function...)" button | |
// 7. push "comress" button | |
// 8. drag & drop your bookmarklet name to your bookmark tab | |
// AA-00 ... ZZZZZ+-99999+ | |
var pattern = /([A-Z]{2,}\-\d{2,})/g; | |
function initPatternList(content) { | |
var match = content.match(pattern); | |
var uniquePatters = [...new Set(match)]; | |
var patternList = uniquePatters.sort().join(', '); | |
alert(patternList); | |
} | |
initPatternList(document.documentElement.innerHTML); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment