Regular expression in python:
import re
str = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 1234-234 1238-888"
# r bole to raw character and
# patt = re.compile(r"Lo")
# .(Dot) kamatlab hota hai all charcter
# patt = re.compile(r".")
#
# patt = re.compile(r"the")
# last ka character agar aise ho to ye return kar denga
# patt = re.compile(r".$")
# pahili line agar isse start hoti hai to wo return kar denga
# patt = re.compile(r"^Lorem")
# a i m kitne bhi hoge wo return kar denga iise
# patt = re.compile(r"a*i*m*")
# isme agar jis jagah specific match atta hai waha par dekhna hai
# patt = re.compile(r"al{2}")
# either aur or in python regular expressions
# patt = re.compile(r"al{2} | Lo")
# patt = re.compile(r"al{2} | Lo")
# special sequence
# agar ye strin lorem se chalu hoti hai to return karenga
# patt = re.compile(r"\ALorem")
# agar chalu hoti hai string to use karte hai
# patt = re.compile(r"\bLorem")
# jaab end hoti hai string taab use hota hai
# patt = re.compile(r"Lorem\b")
# isme maine matches ko liya hai
patt = re.compile(r"\d{4}-\d{3}")
match = patt.finditer(str)
for item in match:
print(item)
Thanks you for commenting your questions. I will see question and respond you.