Regex Gone Wild in Python

Regular Expressions for the Uninitiated

Python's re module has a few tricks up its sleeve. Want to see them?

Or maybe you'd like to see some Regex Puns instead?

[subpages/regex-gone-wild-in-python/regular-expression-cheat-sheet] Regular Expression Cheat Sheet

Regular Expression Cheat Sheet

Quick Reference for the Desperate

Pattern Description
\d{3,} Three or more digits
\w{5,10} Five to ten word characters
abc|def|ghi Match any of the above

Need more? Go Pro!

[subpages/regex-gone-wild-in-python/regular-expression-cheat-sheet/advanced-patterns] Regular Expression Cheat Sheet: Advanced Patterns

Advanced Regular Expression Patterns

For the Truly Insane

Pattern Description
(\d{3})?\d+ Zero, three, or more digits
[a-zA-Z0-9]{8} Eight alphanumeric characters (no whitespace)
\d{2,4}-\d{2} Two or four digits, followed by a hyphen and two more digits

Still confused? Play Regex Games!

[subpages/regex-gone-wild-in-python/regex-tutorial] Regex Tutorial for the Utterly Confused

Regex Tutorial for the Utterly Confused

Chapter 1: Basic Patterns

Let's start with the basics. What is a regular expression, anyway?

  1. Regex is a way to describe a pattern in a string
  2. It's like a secret code that only you understand
  3. You can use it to find, replace, or even extract parts of a string

Next: Chapter 2: Advanced Patterns

[subpages/regex-gone-wild-in-python/regex-tutorial/advanced-patterns] Advanced Regular Expression Patterns

Advanced Regular Expression Patterns

For the Truly Insane

Now that you've mastered the basics, it's time to get really crazy!

  1. Groups! Oh, glorious groups!
  2. Alternations! And negations!
  3. Repeating groups! Like you're having a party!

Still confused? Play Regex Games!

[subpages/regex-gone-wild-in-python/regex-games] Regex Games: Find the Pattern!

Regex Games: Find the Pattern!

Match or Perish!

Pattern Action
\b[0-9]{1,}\b Find all one or more digits in a word
\w{5,} Find all five or more word characters in a string
abc|def|ghi Find any of the above

Want more? Level 2: The Challenge Mode

[subpages/regex-gone-wild-in-python/regex-games/level-2] Regex Games: Level 2 - The Challenge Mode

Regex Games: Level 2 - The Challenge Mode

Where the Patterns Get Crazy!

Pattern Action
(\d{2})\d+(\d{1}) Find any two digits followed by a digit
\w{3,8} Find all three to eight word characters in a string
abc[de]ghi Find any of the above with 'de' in between

Ready for Level 3? Level 3: The Insanity Mode

[subpages/regex-gone-wild-in-python/regex-games/level-3] Regex Games: Level 3 - The Insanity Mode

Regex Games: Level 3 - The Insanity Mode

Where the Patterns Get Truly Crazy!

Pattern Action
(\d{3,}) Find any three or more digits in a word
\w{8,} Find all eight or more word characters in a string
abc|def|ghi|jkl|... Find any of the above, and keep going!

Are you ready to admit defeat? Admit Defeat!

[subpages/regex-gone-wild-in-python/regex-games/defeat] Admit Defeat!

Admit Defeat!

You've been beaten by Regex!

Don't worry, it's not your fault. Regex is just too powerful.

Want to play again? Play Again!

[subpages/regex-gone-wild-in-python/regex-puns] Regex Puns

Regex Puns

Pun-filled fun for everyone!

Want more? More Puns!

[subpages/regex-gone-wild-in-python/regex-puns/more-puns] More Puns!

More Puns!

Because you can never have too many regex puns!

Need a break? Pun Break!