In this example we will show how to get the part of the string where there was a match when searching for a string in Python.
Source Code
import re
str1 = 'I love Python'
r = re.search(r"bP.+", str1)
print(r.group())
Output:
Python
In this example we will show how to get the part of the string where there was a match when searching for a string in Python.
import re
str1 = 'I love Python'
r = re.search(r"bP.+", str1)
print(r.group())
Output:
Python