Created
February 28, 2023 19:04
-
-
Save Caedilla/94faf8dc328ed27c86e5585e28cf4485 to your computer and use it in GitHub Desktop.
Find a good phone number. Searches page for a number with repeating digits, and then searches the rest of the value for more repeating digits.
This file contains 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
const firstRepeating = /(\d)\1{1,2}/; | |
const checkRepeating = /(\d)\1{1,2}/; | |
const selectElements = document.getElementsByTagName('select'); | |
let matchingValues = ''; | |
for (const selectElement of selectElements) { | |
const matchingOptions = selectElement.getElementsByTagName('option'); | |
for (const option of matchingOptions) { | |
const value = option.value; | |
const index = value.search(firstRepeating); | |
if (index !== -1) { | |
const remaining = value.substring(index + 1); | |
if (checkRepeating.test(remaining)) { | |
matchingValues += `"${value}"\n`; | |
} | |
} | |
} | |
} | |
if (matchingValues) { | |
alert(`Matching values found:\n${matchingValues}`); | |
} else { | |
setInterval(() => { | |
location.reload(); | |
}, 500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment