我试图用正则表达式从字符串中筛选出一些垃圾文本,但似乎无法使其正常工作。我不是一个正则表达式专家(甚至没有关闭),我搜索了类似的例子,但似乎没有解决我的问题。匹配多行字符串中特定单词前的所有内容
我需要一个正则表达式,它匹配从字符串开头到字符串中特定单词但不是单词本身的所有内容。
这里有一个例子:
<p>This is the string I want to process with as you can see also contains HTML tags like <i>this</i> and <strong>this</strong></p>
<p>I want to remove everything in the string BEFORE the word "giraffe" (but not "giraffe" itself and keep everything after it.</p>
那么,我该如何匹配单词“长颈鹿”之前在字符串中的一切吗?
谢谢!
+1,至少只要“长颈鹿”仍然是固定字符串。 –
这给了我指定字符串后的输出... – plast1K