Regular expression searching data for a word | Sololearn: Learn to code for FREE!
+ 1

Regular expression searching data for a word

If I want to look up a word ‘ifAdminStatus’ how do I write that regular expression. Do I use the findall? (re.findall(r’[]’,hostInterface))

25th Jan 2019, 3:33 PM
Shyam
Shyam - avatar
1 Answer
+ 1
You can use re.search or re.findall Or even without regular expressions this is easy in Python : print('ifAdminStatus' in hostInterface) Example code to use regex in Python (watch out for details...) I really recommend to read the python classes about regex. Very good for introductory level. https://code.sololearn.com/cH3D82iPIaaX/?ref=app https://www.sololearn.com/learn/Python/2475/
29th Jan 2019, 7:08 PM
Tibor Santa
Tibor Santa - avatar