This question already has an answer here:
- Regex to match whole word 3 answers
- Regex match entire words only 4 answers
- Python regex find all overlapping matches? 3 answers
I want to find 'the phone' pattern but it's couting only one the phone in given line :
pat=r'\sthe\sphone\s'
line=' the phone the phone '
If I give input string with extra space ==' the phone the phone ' the only it will print expected output ['the phone' ,'the phone']
ssss=re.findall(pat,line,re.IGNORECASE)
print(ssss)
output [' the phone ']
I'm using python for this regular expression:
{pat=r'\sthe\sphone\s'
line=' the phone the phone '
ssss=re.findall(pat,line,re.IGNORECASE)
print(ssss)}
Aucun commentaire:
Enregistrer un commentaire