Step 1
Open any text editor (gedit,pico,vi,nano) then enter the following python script and save the file with .py extension.
#!/usr/bin/python
#Author : Jijo K Jose
print "\n————————————\nChapter 20 – Regular Expression 3 \n————————————\n"
import re
in_str = raw_input("Enter the text : ")
se_str = raw_input("Enter search string : ")
reg1 = re.compile(se_str)
find1 = reg1.findall(in_str)
print "\nOutput of – .findall() : ", find1
print "\n———————————–\n"
iter1 = reg1.finditer(in_str)
print "Output of – .finditer() : \n"
for i in iter1:
print i.group()
print "\n———————————–\n"
#END