Python for Network Engineers

Regular Expression Functions in python with examples

By George El. • February 2021 • Reading time: 5 minutes

In this post I will explain all the functions in the re module and then go on to discuss capturing and non capturing groups, non greedy operator, look ahead and look behind positive and negative assertions. Regular expressions can be a little initimidating in the beginning, but once you learn how to use them, you can use them in every language.

Python Regular Expression Examples

By George El. • January 2019 • Reading time: 2 minutes

common regular expressions are \d match a digit + one or more * zero or more . match any ^ beginning of text $ end of text {n} match exactly n characters [ab] match a or b \s matches space you can combine all these, so to match one or more digits in the beginning of line you will use ^\d+