fork download
  1. import re
  2. s = "kanakiya area 1350 sqft asking price : 95 lacs destination properties azymn - 9920902674 \n plot on rent near sp ring road rajpath club ki gali me road touch 5000 war na 350000 rent owner side no b"
  3. pattern = r'\d[\d ,.]*(?:carpet|sft|feet|sqft|yard|gaj|feet|s\.ft|sq\.ft|sq feet|fq\.ft\.|sq\.ft\.|pt|crpt|ft|sq\.mt\.|sq\.mtr|sq\.mt|plot|sf|sfqt|acer|gj|vigha|anna|gunta|sq|gunthe|guntha|bigha|sqd|sqm|sqyd|area|acre|square|yrd|sq\.yard|sq yd|sq\.yd|sq\. yd\.|gaj|sqt)s?'
  4. print(re.findall(pattern, s))
  5. pattern1 = r'(\d(?:[\d ,.]*\d)?)[ \t]*((?:carpet|sft|feet|sqft|yard|gaj|feet|s\.ft|sq\.ft|sq feet|fq\.ft\.|sq\.ft\.|pt|crpt|ft|sq\.mt\.|sq\.mtr|sq\.mt|plot|sf|sfqt|acer|gj|vigha|anna|gunta|sq|gunthe|guntha|bigha|sqd|sqm|sqyd|area|acre|square|yrd|sq\.yard|sq yd|sq\.yd|sq\. yd\.|gaj|sqt)s?)'
  6. print("Now, with captures:")
  7. for m in re.finditer(pattern1, s):
  8. print("{} => {}".format(m.group(1), m.group(2)))
  9.  
Success #stdin #stdout 0.04s 27712KB
stdin
Standard input is empty
stdout
['1350     sqft']
Now, with captures:
1350 => sqft