Help debugging code - Negative lookahead problem

michael.gauthier.uni at gmail.com michael.gauthier.uni at gmail.com
Sun Feb 26 12:15:58 EST 2017


Hi MRAB,

Thanks for taking time to look at my problem!

I tried your solution:

r"\d{2}\s?(?=(?:years old\s?|yo\s?|yr old\s?|y o\s?|yrs  old\s?|year
old\s?)(?!son|daughter|kid|child))" 

but unfortunately it does seem not work. Also, I tried adding the negative lookaheads after every one of the alternatives, but it does not work either, so the problem does not seem to be that the negative lookahead applies only to
the last proposition... : (

Also, \d{2} will only match two single digits, and won't match the last two digits of 101, so at least this is fine! : )

Any other idea to improve that code? I'm starting to get desperate...

Thanks again for your help anyways, I really appreciate it! ; )



More information about the Python-list mailing list