我有一个看起来像这样的字符串:
"Product DescriptionThe Signature Series treatment makes the strategy
guide a COLLECTIBLE ITEM for StarCraft II fans. Single-player CAMPAIGN
WALKTHROUGH covers all possible mission branches, including bonus
objectives throughout the campaign. Exclusive MAPS found only in the
official guide, show locations of units,..."
我虽然这样做是为了删除Product Description
:
description_hash[:description] = @data.at_css('.featureReview span').text[/.*\.\.\./m].delete("Product Description")
但我得到了这个:
"ThSgaSammakhagygaCOLLECTIBLEITEMfSaCafIIfa.Sgl-layCAMAIGNWALKTHROUGHvallblmbah,lgbbjvhghhamag.ExlvMASflyhffalg,hwlaf,..."
我想我只是告诉 Ruby 删除单词中的所有字母Product Description
(加上空格)。但我只想删除前两个词。
这样做的正确方法是什么?