2

我需要为这些系统日志条目提取配置文件。

May 11 09:35:59 server-0548 ea_appserver: env=ACPT profile=product_api java[31185]: 2017-05-11 09:35:59,210 server-0548 org.hibernate.internal.SessionFactoryImpl ServerService Thread Pool -- 51 HHH000008: JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()

以下正则表达式适用于 PCRE,但我似乎无法将其转换为 POSIX。

(?m)profile=(\S+)

我试过了

[^=]*$

.*profile=(.*)

但不能停下来product_api

4

1 回答 1

1

POSIX ERE 不支持内联正则表达式修饰符,并且并不总是支持速记字符类。请注意,即使在您的(?m)profile=(\S+)PCRE 正则表达式中,(?m)MULTILINE 修饰符也是多余的,因为没有^,也没有$重新定义的行为。您可以[:space:]在否定括号表达式中使用 POSIX 字符类(匹配任何空格):

profile=([^[:space:]]+)

详情

  • profile=- 文字子串
  • ([^[:space:]]+)- 组 1:一个或多个字符,不能与[:space:]POSIX 字符类匹配的字符。
于 2017-05-12T19:48:14.187 回答