Open vzakaznikov opened 2 hours ago
Add support to clean values before comparison:
import re # Input strings snapshot_value = "hello 12345.222" repr_value = "hello 23434.333" # Regex pattern to match numbers (both integers and decimals) pattern = r'\d+(\.\d+)?' # Remove numbers from both strings snapshot_stripped = re.sub(pattern, '', snapshot_value) repr_stripped = re.sub(pattern, '', repr_value) # Compare the stripped strings if snapshot_stripped.strip() == repr_stripped.strip(): print("The strings are equal when ignoring numbers.") else: print("The strings are not equal when ignoring numbers.")
Implementation:
snapshot(repr_value,...,func)
func
Add support to clean values before comparison: