我试图在Notepad ++的搜索框中使用正则表达式来查找行块。块中的第一行包含单词Entering
,最后一行包含单词Exiting
:
DEBUG [08052018 03:15:35.769] [http-nio-21380-exec-3] [com.citi.risk.common.util.LoggingAspect] Entering method getDataAsOfDates of class com.citi.risk.fdb.dao.DashBoardDAOImpl
DEBUG [08052018 03:15:35.769] [http-nio-21380-exec-3] [org.springframework.jdbc.core.JdbcTemplate] Executing SQL query [select to_char(max(fac_updated_on),'mm/dd/yyyy') AS MAX_DATE from tb_fd_facilities where fac_updated_by = 'RISKODS_FRMS_FACILITY_JOB']
DEBUG [08052018 03:15:35.833] [http-nio-21380-exec-3] [org.springframework.jdbc.core.JdbcTemplate] Executing SQL query [select to_char(max(rel_updated_on),'mm/dd/yyyy') AS MAX_DATE from tb_relationships where rel_updated_by = 'SYSTEM']
DEBUG [08052018 03:15:35.903] [http-nio-21380-exec-3] [org.springframework.jdbc.core.JdbcTemplate] Executing SQL query [select to_char(max(fdn_nav_date),'mm/dd/yyyy') AS MAX_DATE from tb_fund_details_nav where (fdn_updated_by = 'CE_PROCESS' or fdn_updated_by = 'PROC_UPLD_MKT_DATA') and fdn_nav is not null]
DEBUG [08052018 03:15:36.535] [http-nio-21380-exec-3] [org.springframework.jdbc.core.JdbcTemplate] Executing SQL query [select to_char(max(month_end_date),'mm/dd/yyyy') AS MAX_DATE from tb_optima_feed]
DEBUG [08052018 03:15:36.594] [http-nio-21380-exec-3] [org.springframework.jdbc.core.JdbcTemplate] Executing SQL query [select to_char(max(archive_date),'mm/dd/yyyy') AS MAX_DATE from pstarchive_dates]
DEBUG [08052018 03:15:36.653] [http-nio-21380-exec-3] [org.springframework.jdbc.core.JdbcTemplate] Executing SQL query [select TO_CHAR(max(fdn_pse_date),'mm/dd/yyyy') as MAX_DATE from TB_FUND_DETAILS_NAV where FDN_UPDATED_BY ='CE_PROCESS']
DEBUG [08052018 03:15:37.374] [http-nio-21380-exec-3] [com.citi.risk.common.util.LoggingAspect] Exiting method getDataAsOfDates of class com.citi.risk.fdb.dao.DashBoardDAOImpl
我可以用什么正则表达式来做这件事?
答案 0 :(得分:0)
这应该可行:
(^|\n).*?Entering.*?Exiting.*?(\n|$)
让我们分解吧。您想要从字符串的开头(^
)或换行符(\n
)进行匹配:
(^|\n)
行(.
)中的任何字符,任意次(*
),但可以获得最小的匹配(?
),因此我们无法匹配下一个块;后跟单词Entering
:
.*?Entering
然后,再次,任何字符,但可能的最小匹配,然后是Exiting
:
.*?Exiting
然后,任意次,任何字符,然后是(|
)换行符(\n
)或字符串结尾($
)。