簡體   English   中英

正則表達式匹配單詞中的a字符串,並且該單詞必須出現在句子的最后一個單詞

[英]Regex to match the a string in a word, and that word must appear at the last word of the sentence

我想匹配應該在句子/行末尾的模式(即錯誤/異常)(有多行)。

前任:

ABC.sfgs.maxRetriesOnError(StringNameSpaceBinding)
ABC.jjg.clm.fg.sg(sd/ifgap|sgf.xml#sf)
NullPointerException
numberError

從上面的字符串中,它應該匹配 NullPointerException 和 numberError

我試過這個 -

(/\w*[eE]rror\s|\w*[eE]xception\s/)

,但它不能正常工作

試試這個:/.*([Ee]( /.*([Ee](?:xception|rror))$/gm /gm

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM