Regular Expression | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Regular Expression

How to use regular expression to find 'Roy' in string: Roy plays football.

29th Jun 2018, 4:18 AM
Shivanshu Gupta
Shivanshu Gupta - avatar
1 Answer
+ 3
import re text="Roy plays football." p=re.search("Roy", text) if p: print ("Found Roy!") else: print ("No Roy found.")
30th Jun 2018, 2:57 PM
George Ryan
George Ryan - avatar