我有这样一个字符串:
"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,... \n\n\n\n\n\n\nRead More\n"
如何使用正则表达式 .text[/(...)/]
删除 ...
之后的内容,以便输出如下所示?
"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,..."
最佳答案
你需要避开那个时期。
string.sub(/(?<=\.\.\.).*/m, "")
或
string[/.*\.\.\./m]
关于ruby - 使用正则表达式删除 "..."之后的所有内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18508492/