# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"by([^(b(?>y))])+"
test_str = "zzzzzzzzzzzzzzzzzzeererezzz By LITE-ON!Model: PA-1121-12H, PA-1121-12R!Series: PPP017L!HP Part No.: 316688-001, 394900-001, 393946-001!!By HIPRO!Model: HP-OW121F13!Series: PPP017H!HP Part No.: 316688-002!!By Fordgood!Model: 0309A18120!Series: PPP017S!HP Part No.: 316688-003 !Replace with HP Spare No.: 317188-001!Compatible HP Spare No.: 350775-001!!Input: 110-240V~ 2.5A, 50-60Hz!Output: 18.5V 6.5A 120W!Connecter size: Int. Diameter: 2.50mm Ext. Diameter: 5.50mm Length : 14.00mm!!Dimension: 168 x 62 x 37 mm!!*For use with Presario 3000xx notebook series.!!**Please take note, 3 wire AC power cord not included.!!/by([^(b(?>y))])+/gi"
subst = ""
# You can manually specify the number of replacements by changing the 4th argument
result = re.sub(regex, subst, test_str, 0, re.IGNORECASE)
if result:
print (result)
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html