Loading...
Loading...
Test Python regular expressions with live preview and explanations
import re
pattern = r"\d+"
text = "There are 42 apples and 7 oranges in 3 baskets."
result = re.findall(pattern, text)
print(result)re.findall() — Find ALL matches, return listre.search() — Find FIRST match anywherere.match() — Match at START of string onlyre.sub() — Replace all matches