Regular Expressions

In this blog, we are going to explore the world of regular expressions Regular expressions are used for parsing and validating strings especially in applications of Natural Language Processing 1. Literals Pattern Meaning cat Match all occurences of “cat” anywhere inside the text 2. Character Classes Pattern Meaning [abc] a or b or c [a-zA-Z0-9] Any lowercase or uppercase or digit [^a-z] Anything except lowercase 3. Quantifiers Pattern Meaning * 0 or more occurence + 1 or more occurence ? 0 or 1 occurence {n} Exactly n occurences {n,} n or more occurences {n, m} Between n and m occurences 4. Anchors Pattern Meaning ^ Start of a string $ End of a string \b Word boundary \B Non-boundary 5. Grouping Pattern Meaning (abc) Grouping (useful for extraction) 6. Alternation Pattern Meaning a|b Alternation (a or b) 7. Escape Sequences Pattern Meaning \. When you want to use a “.” or any other symbol in literal sense use “\” as an escape sequence 8. Predefined Classes Pattern Meaning \d digit(0-9) \D non-digit \w word char (letters, digits) \W non-word char \s whitespace \S non-whitespace Python re module Search ( Find first occurence of the pattern in the text ) Find first word starting with capital letter ...

December 5, 2025 · 2 min · Renny Harlin

Hello World

My first Hello World post.

November 1, 2025 · 1 min · Renny Harlin