{"id":268,"date":"2007-10-08T00:00:00","date_gmt":"2007-10-08T00:00:00","guid":{"rendered":"http:\/\/www.strongd.net\/?p=268"},"modified":"2007-10-08T00:00:00","modified_gmt":"2007-10-08T00:00:00","slug":"TestRegex  regexp","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=268","title":{"rendered":"TestRegex  regexp"},"content":{"rendered":"<p>&nbsp;<br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>package<\/B><\/FONT><FONT color=#000000> net.strong.util;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>import<\/B><\/FONT><FONT color=#000000> org.apache.oro.text.regex.MatchResult;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>import<\/B><\/FONT><FONT color=#000000> org.apache.oro.text.regex.Pattern;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>import<\/B><\/FONT><FONT color=#000000> org.apache.oro.text.regex.PatternCompiler;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>import<\/B><\/FONT><FONT color=#000000> org.apache.oro.text.regex.PatternMatcher;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>import<\/B><\/FONT><FONT color=#000000> org.apache.oro.text.regex.PatternMatcherInput;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>import<\/B><\/FONT><FONT color=#000000> org.apache.oro.text.regex.Perl5Compiler;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>import<\/B><\/FONT><FONT color=#000000> org.apache.oro.text.regex.Perl5Matcher;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>import<\/B><\/FONT><FONT color=#000000> org.apache.oro.text.regex.Perl5Substitution;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>import<\/B><\/FONT><FONT color=#000000> org.apache.oro.text.regex.Util;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>public<\/B><\/FONT><FONT color=#000000> <\/FONT><FONT color=#7f0055><B>class<\/B><\/FONT><FONT color=#000000> TestRegex {<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><\/FONT><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>public<\/B><\/FONT><FONT color=#000000> TestRegex() {}<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><\/FONT><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>public<\/B><\/FONT><FONT color=#000000> <\/FONT><FONT color=#7f0055><B>void<\/B><\/FONT><FONT color=#000000> parseLog() <\/FONT><FONT color=#7f0055><B>throws<\/B><\/FONT><FONT color=#000000> Exception {<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>String log1=<\/FONT><FONT color=#2a00ff>&#8220;172.26.155.241 &#8211; &#8211; [26\/Feb\/2001:10:56:03 -0500] \\&#8221;GET \/IsAlive.htm HTTP\/1.0\\&#8221; 200 15 &#8220;<\/FONT><FONT color=#000000>;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>String regexp=<\/FONT><FONT color=#2a00ff>&#8220;(\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3})\\\\s-\\\\s-\\\\s\\\\[([^\\\\]]+)\\\\]&#8221;<\/FONT><FONT color=#000000>;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>PatternCompiler compiler=<\/FONT><FONT color=#7f0055><B>new<\/B><\/FONT><FONT color=#000000> Perl5Compiler();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>Pattern pattern=compiler.compile(regexp);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>PatternMatcher matcher=<\/FONT><FONT color=#7f0055><B>new<\/B><\/FONT><FONT color=#000000> Perl5Matcher();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><\/FONT><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>if<\/B><\/FONT><FONT color=#000000> (matcher.contains(log1,pattern)) {<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>MatchResult result=matcher.getMatch();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>System.<\/FONT><FONT color=#0000c0><I>out<\/I><\/FONT><FONT color=#000000>.println(<\/FONT><FONT color=#2a00ff>&#8220;IP: &#8220;<\/FONT><FONT color=#000000>+result.group(1));<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>System.<\/FONT><FONT color=#0000c0><I>out<\/I><\/FONT><FONT color=#000000>.println(<\/FONT><FONT color=#2a00ff>&#8220;Timestamp: &#8220;<\/FONT><FONT color=#000000>+result.group(2));<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>}<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>}<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><\/FONT><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>public<\/B><\/FONT><FONT color=#000000> <\/FONT><FONT color=#7f0055><B>void<\/B><\/FONT><FONT color=#000000> parseHTML() <\/FONT><FONT color=#7f0055><B>throws<\/B><\/FONT><FONT color=#000000> Exception {<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>String html=<\/FONT><FONT color=#2a00ff>&#8220;&lt;font face=\\&#8221;Arial, Serif\\&#8221; size=\\&#8221;+1\\&#8221;color=\\&#8221;red\\&#8221;&gt;&#8221;<\/FONT><FONT color=#000000>;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>String regexpForFontTag=<\/FONT><FONT color=#2a00ff>&#8220;&lt;\\\\s*font\\\\s+([^&gt;]*)\\\\s*&gt;&#8221;<\/FONT><FONT color=#000000>;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>String regexpForFontAttrib=<\/FONT><FONT color=#2a00ff>&#8220;([a-z]+)\\\\s*=\\\\s*\\&#8221;([^\\&#8221;]+)\\&#8221;&#8221;<\/FONT><FONT color=#000000>;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>PatternCompiler compiler=<\/FONT><FONT color=#7f0055><B>new<\/B><\/FONT><FONT color=#000000> Perl5Compiler();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>Pattern patternForFontTag=compiler.compile(regexpForFontTag,Perl5Compiler.<\/FONT><FONT color=#0000c0><I>CASE_INSENSITIVE_MASK<\/I><\/FONT><FONT color=#000000>);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>Pattern patternForFontAttrib=compiler.compile(regexpForFontAttrib,Perl5Compiler.<\/FONT><FONT color=#0000c0><I>CASE_INSENSITIVE_MASK<\/I><\/FONT><FONT color=#000000>);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>PatternMatcher matcher=<\/FONT><FONT color=#7f0055><B>new<\/B><\/FONT><FONT color=#000000> Perl5Matcher();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><\/FONT><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>if<\/B><\/FONT><FONT color=#000000> (matcher.contains(html,patternForFontTag)) {<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>MatchResult result=matcher.getMatch();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>String attrib=result.group(1);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>PatternMatcherInput input=<\/FONT><FONT color=#7f0055><B>new<\/B><\/FONT><FONT color=#000000> PatternMatcherInput(attrib);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><\/FONT><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>while<\/B><\/FONT><FONT color=#000000> (matcher.contains(input,patternForFontAttrib)) {<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>result=matcher.getMatch();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>System.<\/FONT><FONT color=#0000c0><I>out<\/I><\/FONT><FONT color=#000000>.println(result.group(1)+<\/FONT><FONT color=#2a00ff>&#8220;: &#8220;<\/FONT><FONT color=#000000>+result.group(2));<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>}<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>}<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>}<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><\/FONT><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>public<\/B><\/FONT><FONT color=#000000> <\/FONT><FONT color=#7f0055><B>void<\/B><\/FONT><FONT color=#000000> substitutelink() <\/FONT><FONT color=#7f0055><B>throws<\/B><\/FONT><FONT color=#000000> Exception {<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>String link=<\/FONT><FONT color=#2a00ff>&#8220;&lt;a href=\\&#8221;http:\/\/widgets.acme.com\/interface.html#How_To_Trade\\&#8221;&gt;&#8221;<\/FONT><FONT color=#000000>;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>String regexpForLink=<\/FONT><FONT color=#2a00ff>&#8220;&lt;\\\\s*a\\\\s+href\\\\s*=\\\\s*\\&#8221;http:\/\/widgets.acme.com\/interface.html#([^\\&#8221;]+)\\&#8221;&gt;&#8221;<\/FONT><FONT color=#000000>;<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>PatternCompiler compiler=<\/FONT><FONT color=#7f0055><B>new<\/B><\/FONT><FONT color=#000000> Perl5Compiler();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>Pattern patternForLink=compiler.compile(regexpForLink,Perl5Compiler.<\/FONT><FONT color=#0000c0><I>CASE_INSENSITIVE_MASK<\/I><\/FONT><FONT color=#000000>);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>PatternMatcher matcher=<\/FONT><FONT color=#7f0055><B>new<\/B><\/FONT><FONT color=#000000> Perl5Matcher();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>String result=Util.<I>substitute<\/I>(matcher,<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>patternForLink,<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><\/FONT><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>new<\/B><\/FONT><FONT color=#000000> Perl5Substitution(<\/FONT><FONT color=#2a00ff>&#8220;&lt;a href=\\&#8221;http:\/\/newserver.acme.com\/interface.html#$1\\&#8221;&gt;&#8221;<\/FONT><FONT color=#000000>),<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>link,<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>Util.<\/FONT><FONT color=#0000c0><I>SUBSTITUTE_ALL<\/I><\/FONT><FONT color=#000000>);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>System.<\/FONT><FONT color=#0000c0><I>out<\/I><\/FONT><FONT color=#000000>.println(result);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>}<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><\/FONT><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2><FONT color=#7f0055><B>public<\/B><\/FONT><FONT color=#000000> <\/FONT><FONT color=#7f0055><B>static<\/B><\/FONT><FONT color=#000000> <\/FONT><FONT color=#7f0055><B>void<\/B><\/FONT><FONT color=#000000> main(String[] args) <\/FONT><FONT color=#7f0055><B>throws<\/B><\/FONT><FONT color=#000000> Exception {<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>TestRegex test=<\/FONT><FONT color=#7f0055><B>new<\/B><\/FONT><FONT color=#000000> TestRegex();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>System.<\/FONT><FONT color=#0000c0><I>out<\/I><\/FONT><FONT color=#000000>.println(<\/FONT><FONT color=#2a00ff>&#8220;\\n\\nLog Parsing Example&#8221;<\/FONT><FONT color=#000000>);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>test.parseLog();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>System.<\/FONT><FONT color=#0000c0><I>out<\/I><\/FONT><FONT color=#000000>.println(<\/FONT><FONT color=#2a00ff>&#8220;\\n\\nHtml Example 1&#8221;<\/FONT><FONT color=#000000>);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>test.parseHTML();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>System.<\/FONT><FONT color=#0000c0><I>out<\/I><\/FONT><FONT color=#000000>.println(<\/FONT><FONT color=#2a00ff>&#8220;\\n\\nHtml Example 2&#8221;<\/FONT><FONT color=#000000>);<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>test.substitutelink();<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>}<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><FONT color=#000000><FONT face=\u00cb\u00ce\u00cc\u00e5><FONT size=2>}<\/FONT><\/FONT><\/FONT><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\" align=left><BR><\/P><br \/>\n<P style=\"MARGIN-BOTTOM: 0cm\"><BR><\/P><br \/>\n<DIV><\/DIV><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; package net.strong.util; import org.apache.oro.text.regex.MatchResult; import org.apache.oro.text.regex.Pattern; import org.apache.oro.text.regex.PatternCompiler; import org.apache.oro.text.regex.PatternMatcher; import org.apache.oro.text.regex.PatternMatcherInput; import org.apache.oro.text.regex.Perl5Compiler; import org.apache.oro.text.regex.Perl5Matcher; import org.apache.oro.text.regex.Perl5Substitution; import org.apache.oro.text.regex.Util; public class TestRegex { public TestRegex() {} public void parseLog() throws Exception { String log1=&#8220;172.26.155.241 &#8211; &#8211; [26\/Feb\/2001:10:56:03 -0500] \\&#8221;GET \/IsAlive.htm HTTP\/1.0\\&#8221; 200 15 &#8220;; String regexp=&#8220;(\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3})\\\\s-\\\\s-\\\\s\\\\[([^\\\\]]+)\\\\]&#8221;; PatternCompiler compiler=new Perl5Compiler(); Pattern pattern=compiler.compile(regexp); PatternMatcher matcher=new &hellip; <a href=\"https:\/\/www.strongd.net\/?p=268\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">TestRegex  regexp<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-268","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=268"}],"version-history":[{"count":0,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/268\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}