您好我有一段:
output:
I am Deepak
I study Computers
I find it interesting
I like listening to music
You also like listening to music
我想从“输出”中提取到“我喜欢”:
output:
I am Deepak
I study Computers
I find it interesting
I like
这是我使用的正则表达式: (?< = output)([^ \ n] *)(?=听音乐)。但我没有达到我的预期。
这就是我得到的:
output
I am Deepak
I study Computers
I find it interesting
I like listening to music
You also like
任何人都可以帮忙吗?
答案 0 :(得分:0)
使用非贪婪量化:
output[^\n]*?(?= listening to music)
(我想你实际上想要'输出'这个词。)