Just for fun tool to search in the Wordle wordlist.
Usage
Usage of ./wordle-solver:
-except string
Characters to except (e.g.: "aeou")
-match string
The string to match (placeholder: .) (default ".....")
-wordlist string
Wordlist to use (default "Wordlist")
Example Todays Worlde is “BRAND” for example and we started with “IRATE”.
wordle-solver -match ".ra.." -except "ite"
You got a list of 27 possible words.
package main
import (
"bufio"
"flag"
"fmt"
"log"
"os"
"regexp"
)
func main() {
wordlistFlag := flag.String("wordlist", "Wordlist", "Wordlist to use")
matchFlag := flag.String("match", ".....", "The string to match (placeholder: .)")
exceptFlag := flag.String("except", "", "Characters to except (e.g.: \"aeou\")")
flag.Parse()
file, err := os.Open(*wordlistFlag)
if err != nil {
log.Fatal(err)
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
match, _ := regexp.MatchString(*matchFlag, scanner.Text())
except, _ := regexp.MatchString(fmt.Sprintf(`[%s]`, *exceptFlag), scanner.Text())
if match && !except {
fmt.Println(scanner.Text())
}
}
}
Top comments (0)