Category: New Python tutorial

python tutorials and learn python

Created with Sketch.

Python Regex search()

Python Regex search() Summary: in this tutorial, you’ll learn how to use the Python regex search() function to return the first match of a pattern in a string. Introduction to the Python regex search() function The regex search() is a function in the built-in re module that deals with regular expressions. The search() function has…
Read more

Python Regex match()

Python Regex match()   Summary: in this tutorial, you’ll learn how to use the Python regex match() function to find a match with a pattern at the beginning of a string. Introduction to the Python regex match function The re module has the match() function that allows you to search for a pattern at the…
Read more

Python Regex finditer()

Python Regex finditer()   Summary: in this tutorial, you’ll learn how to use the Python regex finditer() function to find all matches in a string and return an iterator that yields match objects. Introduction to the Python regex finditer function The finditer() function matches a pattern in a string and returns an iterator that yields…
Read more

Python Regex fullmatch()

Python Regex fullmatch() Summary: in this tutorial, you’ll learn how to use the Python regex fullmatch() to match the whole string with a regular expression. Introduction to the Python regex fullmatch function The fullmatch() function returns a Match object if the whole string matches the search pattern of a regular expression, or None otherwise. The…
Read more

Python Regex findall()

Python Regex findall() Summary: in this tutorial, you’ll learn how to use the Python regex findall() function to find all matches of a pattern in a string. Introduction to the Python regex findall() function The findall() is a built-in function in the re module that handles regular expressions. The findall() function has the following syntax:…
Read more

Python Regex Lookbehind

Python Regex Lookbehind Summary: in this tutorial, you’ll learn about Python regex lookbehind and negative lookbehind. Introduction to the Python regex lookbehind In regular expressions, the lookbehind matches an element if there is another specific element before it. The lookbehind has the following syntax: (?<=Y)X   In this syntax, the pattern will match X if…
Read more

Python Regex Lookahead

Python Regex Lookahead Summary: in this tutorial, you’ll learn about Python regex lookahead and negative lookahead. Introduction to the Python regex lookahead Sometimes, you want to match X but only if it is followed by Y. In this case, you can use the lookahead in regular expressions. The syntax of the lookahead is as follows:…
Read more

Python Regex Non-capturing Group

Python Regex Non-capturing Group Summary: in this tutorial, you’ll learn about the Python regex non-capturing group to create a group but don’t want to store it in the groups of the match. Introduction to the Python regex non-capturing group Regular expressions have two types of groups: Capturing groups Non-capturing groups So far, you learned how…
Read more

Python Regex Alternation

Python Regex Alternation Summary: in this tutorial, you’ll learn about Python regex alternation, which behaves like the “OR” operator in regular expressions. Introduction to the Python regex alternation To represent an alternation in regular expressions, you use the pipe operator (|). The pipe operator is called the alternation. It is like the or operator in…
Read more

Python Regex Backreferences

Python Regex Backreferences Summary: in this tutorial, you’ll learn about Python regex backreferences and how to apply them effectively. Introduction to the Python regex backreferences Backreferences like variables in Python. The backreferences allow you to reference capturing groups within a regular expression. The following shows the syntax of a backreference: \N Code language: Python (python)…
Read more