<pre name="code" class="html"># User@Host: zjzc_app[zjzc_app] @ [10.171.243.55] Id: 1621705 # Query_time: 10.666552 Lock_time: 0.000392 Rows_sent: 15 Rows_examined: 24829551 SET timestamp=1452566321; SELECT * FROM (SELECT c.sn, c.userNick, c.mobilePhone, DATE_FORMAT(c.registerTime, '%Y/%m/%d') registerTime, cp.personName, cp.personCar (?m)s*# User@Host:s+S+[%{USER:user}]s+@s+[%{IP:clientip}]s+(?<id>(S+:s+S+))s*#s+Query_time:s+%{NUMBER:Query_time}s+Lock_time: %{NUMBER:lock_time}s+Rows_sent: %{NUMBER:rows_sent}s+Rows_examined: %{NUMBER:rows_examined}s* s*SETs+timestamp=%{NUMBER:timestamp};s*(?<query>(s*S+s*).*)s* { "user": [ [ "zjzc_app" ] ], "clientip": [ [ "10.171.243.55" ] ], "id": [ [ "Id: 1621705" ] ], "Query_time": [ [ "10.666552" ] ], "lock_time": [ [ "0.000392" ] ], "rows_sent": [ [ "15" ] ], "rows_examined": [ [ "24829551" ] ], "timestamp": [ [ "1452566321" ] ], "query": [ [ "SELECT * FROM (SELECT c.sn, c.userNick, c.mobilePhone, DATE_FORMAT(c.registerTime, '%Y/%m/%d') registerTime, cp.personName, cp.personCar" ] ] } s*(?<query>(s*S+s*).*)s* .* 所有任意数量字符。与前一字符结合,可不出现字符 让.* 去匹配任意多的换行,(?m) 可以让.去匹配换行 据我所知我知道正则引擎是默认不能用.(点号)匹配换行 因此匹配在新行会停止