re = /by([^(b(?>y))])+/i
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 = ''
result = str.gsub(re, subst)
# Print the result of the substitution
puts result
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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html