jquery 怎么 使用 正则表达式 提取 字符串中的时间
例如字符串20-Sep-201814:58:39.686信息[localhost-startStop-1]org.apache.jasper.servlet.TldSca...
例如字符串20-Sep-2018 14:58:39.686 信息 [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
20-Sep-2018 14:58:39.693 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory E:\apache\apache-tomcat-8.0.50\webapps\manager has finished in 293 ms
20-Sep-2018 14:58:39.693 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory E:\apache\apache-tomcat-8.0.50\webapps\ROOT
20-Sep-2018 14:58:40.008 信息 [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR w 展开
20-Sep-2018 14:58:39.693 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory E:\apache\apache-tomcat-8.0.50\webapps\manager has finished in 293 ms
20-Sep-2018 14:58:39.693 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory E:\apache\apache-tomcat-8.0.50\webapps\ROOT
20-Sep-2018 14:58:40.008 信息 [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR w 展开
2个回答
展开全部
var s = '20-Sep-2018 14:58:39.686 信息 [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them.'+
'20-Sep-2018 14:58:39.693 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory E:\apache\apache-tomcat-8.0.50\webapps\manager has finished in 293 ms'+
'20-Sep-2018 14:58:39.693 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory E:\apache\apache-tomcat-8.0.50\webapps\ROOT'+
'20-Sep-2018 14:58:40.008 息 [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR w';
s.match(/\d{2}:\d{2}:\d{2}\.\d{3}(?=\s+信息)/g);
追问
首先感谢回复,我看了下后缀这个能换个写法么,因为后缀可能各种求情况,还有时间格式,这个能多提供几个么,在match里或则,匹配获取几种常见的时间格式,麻烦给回复下,我提高了悬赏分数,谢谢。
追答
还是要要据你的实际情况, 就算加了其它时间格式,如果用不到也没用,还影响性能,最好看看有没有什么地方是固定不变的.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询