[英]RegEx to match a string of two words but not match t if it has the third
當我有一串單詞時,我試圖過濾掉卷心菜這個詞。
我希望以下內容完全匹配。 它一定是這樣強大的:
apple banana
僅當確實如此。 但有時我有一個字符串是
apple banana cabbage
我根本不希望它匹配。 我不希望該字符串中的任何內容匹配。
我試過
/^apple banana$/
但它似乎不起作用。
有什么建議嗎?
(?m)^apple banana$
/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.