Search⌘ K
AI Features

Python regex `search` function

Explore the use of Python's re.search function to find the first match of a pattern in a string. Understand how to apply flags for case sensitivity, multiline matching, and more. Learn to retrieve matched groups and positions using group methods, helping you manipulate text with regex efficiently.

We'll cover the following...

The Search Function

The search function searches for first occurance of a re pattern to string with optional flags.

Here is the syntax for this function −

re.search(pattern,
...