Regular Expressions in Python


Use the re module for string searching and manipulation.

Source Code

import re

# Search for the word "hello"
text = "Hello, world!"
match = re.search("hello", text, re.IGNORECASE)
if match:
    print("Found:", match.group())
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments