python - Regex match if not before and after -


How can I 'suck' if not part of 'Honeyxi'?

Look-alings and see if I can match sucking if I do not 'Honey' or 'Suck', but it also fails to catch something like 'Honnisk'; Here the expression should , as it does not end in le :

  re.search (r '(? & Lt;! Honey) ) Suck (?! Li) ',' Hoanseckar ')    

You're behind the nest Assertion of:

  & gt; & Gt; & Gt; Import re & gt; & Gt; & Gt; Regex = re.compile (r "(? & Lt;! Honey (? = Suck)) suck")> gt; & Gt; & Gt; Regex.search ("Honuscle") & gt; & Gt; & Gt; Regex.search ("honeysucker") & lt; _sre.SRE_Match object 0x00000000029B6370 & gt; & Gt; & Gt; & Gt; Regex.search ("suckle") & lt; _sre.SRE_Match object 0x00000000029B63D8 & gt; & Gt; & Gt; & Gt; Regex.search ("suck") & lt; _sre.SRE_Match object 0x00000000029B6370 & gt;   

An equivalent solution would be suck (?! (? & Lt; = honeysuck) le) .

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -