regex - Python Regular Expression for stopping in between -


this string:

age: adult/child gender: male/female age range: 3 - 5 years/5 - 8 years/8 - 12 yrs/12 years , up product type: costume character: animals & insects material: polyester theme: animal age start: 3 years age end: adult features: -face seen through mouth of zebra. -zipper closure in front , tail in back. -set includes: jumpsuit , head mask. -animal collection. age: -adult/child. gender: -male/female. age group: -3 - 5 years/5 - 8 years/8 - 12 years/12 yrs , up

i want catch bold part python regex. not able it. used regex not working quite possibly. regex is:

\bage[a-z]?\b.*\d+\s(?:years[a-z]?|yrs|month[a-z]+) 

this getting weird answer, catching unwanted string.

you can use following:

\bage range:\s*(?:\d+\s*-\s*\d+\s*y(?:ea)?rs/)+\d+\s*y(?:ea)?rs , up\b 

see demo


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -