diff options
-rw-r--r-- | bot/resources/tags/regex.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/resources/tags/regex.md b/bot/resources/tags/regex.md index 35fee45a9..ae7960b37 100644 --- a/bot/resources/tags/regex.md +++ b/bot/resources/tags/regex.md @@ -5,9 +5,9 @@ Regular expressions (regex) are a tool for finding patterns in strings. The stan We can use regex to pull out all the numbers in a sentence: ```py >>> import re ->>> x = "On Oct 18 1963 a cat was launched aboard rocket #47" +>>> text = "On Oct 18 1963 a cat was launched aboard rocket #47" >>> regex_pattern = r"[0-9]{1,3}" # Matches 1-3 digits ->>> re.findall(regex_pattern, foo) +>>> re.findall(regex_pattern, text) ['18', '196', '3', '47'] # Notice the year is cut off ``` **See Also** |