Can someone tell me why there is nothing in my output file even though the target is in the file this script is searching, it even says saved in matches.txt
Here is the script
import re
# List of target public keys
target_public_keys = '0370e7c3d922008d9ccea410d560cd440a834a811a1ea74c2967637ca015a788a3'
# Regular expression pattern for matching public keys
pattern = r"\b(" + "|".join(target_public_keys) + r")\b"
# Output file to log matches
output_file = "matches.txt"
# List of files to search through
files_to_search =[
"Finish-him-Jack-wins.txt"]
# Open the output file for writing
with open(output_file, "w") as output:
for filename in files_to_search:
with open(filename, "r") as file:
content = file.read()
matches = re.findall(pattern, content)
if matches:
output.write(f"Matches found in {filename}:\n")
for match in matches:
output.write(match + "\n")
output.write("\n")
print("Search completed. Matching public keys saved in", output_file)
Appreciate any help.