我想在给定字符串之后匹配文本。在这种情况下,以“ BookTitle”开头但在第一个空格之前的行的文本:
BookTitle:HarryPotter JK Rowling
BookTitle:HungerGames Suzanne Collins
Author:StephenieMeyer BookTitle:Twilight
所需的输出是:
HarryPotter
HungerGames
我试过:"^BookTitle(.*)"
但这给了我与BookTitle:匹配的地方,而且还有空白之后的所有东西。有人帮忙吗?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句