<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1875536396171598176</id><updated>2011-11-27T16:00:50.067-08:00</updated><category term='RegX'/><title type='text'>Java Regular Expression</title><subtitle type='html'>Java Regular Expression - Examples ,Resources , Tutorials Blog</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javaregularexpression.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1875536396171598176/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://javaregularexpression.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>com blog</name><uri>http://www.blogger.com/profile/13758237633809870651</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1875536396171598176.post-492685214790958758</id><published>2008-05-25T10:12:00.000-07:00</published><updated>2008-05-25T10:17:09.921-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RegX'/><title type='text'>Address: ZIP code (US) Reguler Expression</title><content type='html'>&lt;script type="text/javascript"&gt;&lt;!-- function regexbuddyhighlight(regexoffset) {   document.getElementById("regex" + regexoffset).style.background = "#FFFF00";   document.getElementById("tree" + regexoffset).style.background = "#FFFF00"; } function regexbuddyclear(regexoffset) {   document.getElementById("regex" + regexoffset).style.background = "white";   document.getElementById("tree" + regexoffset).style.background = "white"; } function regexbuddyhighlightdup(regexoffset) {   document.getElementById("regex" + regexoffset).style.background = "#FFFF00";   document.getElementById("tree" + regexoffset + "dup").style.background = "#FFFF00"; } function regexbuddycleardup(regexoffset) {   document.getElementById("regex" + regexoffset).style.background = "white";   document.getElementById("tree" + regexoffset + "dup").style.background = "white"; } --&gt;&lt;/script&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;!-- body { margin: 0; padding: 0; background-color: white; color: black; height: 100%; } div.regexbuddyregex { margin: 10pt; } div.regexbuddytree { margin: 10pt; overflow-y: scroll; height: 70%; } div.regexbuddyfooter { margin: 10pt; } --&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="regexbuddyregex"&gt;&lt;h1&gt;Address: ZIP code (US)&lt;/h1&gt;&lt;br /&gt;&lt;tt class="regexbuddy"&gt;&lt;span id="regex0" onmouseover="regexbuddyhighlight('0')" onmouseout="regexbuddyclear('0')"&gt;\b&lt;/span&gt;&lt;span id="regex4" onmouseover="regexbuddyhighlight('4')" onmouseout="regexbuddyclear('4')"&gt;[0-9]&lt;/span&gt;&lt;span id="regex14" onmouseover="regexbuddyhighlight('14')" onmouseout="regexbuddyclear('14')"&gt;{5}&lt;/span&gt;&lt;span id="regex20" onmouseover="regexbuddyhighlight('20')" onmouseout="regexbuddyclear('20')"&gt;(?:&lt;/span&gt;&lt;span id="regex26" onmouseover="regexbuddyhighlight('26')" onmouseout="regexbuddyclear('26')"&gt;-&lt;/span&gt;&lt;span id="regex28" onmouseover="regexbuddyhighlight('28')" onmouseout="regexbuddyclear('28')"&gt;[0-9]&lt;/span&gt;&lt;span id="regex38" onmouseover="regexbuddyhighlight('38')" onmouseout="regexbuddyclear('38')"&gt;{4}&lt;/span&gt;&lt;span onmouseover="regexbuddyhighlight('20')" onmouseout="regexbuddyclear('20')"&gt;)&lt;/span&gt;&lt;span id="regex46" onmouseover="regexbuddyhighlight('46')" onmouseout="regexbuddyclear('46')"&gt;?&lt;/span&gt;&lt;span id="regex48" onmouseover="regexbuddyhighlight('48')" onmouseout="regexbuddyclear('48')"&gt;\b&lt;/span&gt;&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="regexbuddytree"&gt;&lt;ul class="regexbuddy"&gt;&lt;li class="regexanchor"&gt;&lt;span id="tree0" onmouseover="regexbuddyhighlight('0')" onmouseout="regexbuddyclear('0')"&gt;Assert position at a word boundary&lt;/span&gt;&lt;/li&gt;&lt;li class="regexcharclassrange"&gt;&lt;span id="tree4" onmouseover="regexbuddyhighlight('4')" onmouseout="regexbuddyclear('4')"&gt;Match a single character in the range between "0" and "9"&lt;/span&gt;&lt;ul class="regexbuddy"&gt;&lt;li class="regexrepeat"&gt;&lt;span id="tree14" onmouseover="regexbuddyhighlight('14')" onmouseout="regexbuddyclear('14')"&gt;Exactly 5 times&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li class="regexgroup"&gt;&lt;span id="tree20" onmouseover="regexbuddyhighlight('20')" onmouseout="regexbuddyclear('20')"&gt;Match the regular expression below&lt;/span&gt;&lt;ul class="regexbuddy"&gt;&lt;li class="regexrepeat"&gt;&lt;span id="tree46" onmouseover="regexbuddyhighlight('46')" onmouseout="regexbuddyclear('46')"&gt;Between zero and one times, as many times as possible, giving back as needed (greedy)&lt;/span&gt;&lt;/li&gt;&lt;li class="regexliteral"&gt;&lt;span id="tree26" onmouseover="regexbuddyhighlight('26')" onmouseout="regexbuddyclear('26')"&gt;Match the character "-" literally&lt;/span&gt;&lt;/li&gt;&lt;li class="regexcharclassrange"&gt;&lt;span id="tree28" onmouseover="regexbuddyhighlight('28')" onmouseout="regexbuddyclear('28')"&gt;Match a single character in the range between "0" and "9"&lt;/span&gt;&lt;ul class="regexbuddy"&gt;&lt;li class="regexrepeat"&gt;&lt;span id="tree38" onmouseover="regexbuddyhighlight('38')" onmouseout="regexbuddyclear('38')"&gt;Exactly 4 times&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li class="regexanchor"&gt;&lt;span id="tree48" onmouseover="regexbuddyhighlight('48')" onmouseout="regexbuddyclear('48')"&gt;Assert position at a word boundary&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="regexbuddyfooter"&gt;&lt;p&gt;Created with &lt;a href="http://www.regexbuddy.com/"&gt;RegexBuddy&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1875536396171598176-492685214790958758?l=javaregularexpression.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaregularexpression.blogspot.com/feeds/492685214790958758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1875536396171598176&amp;postID=492685214790958758' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1875536396171598176/posts/default/492685214790958758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1875536396171598176/posts/default/492685214790958758'/><link rel='alternate' type='text/html' href='http://javaregularexpression.blogspot.com/2008/05/address-zip-code-us-reguler-expression.html' title='Address: ZIP code (US) Reguler Expression'/><author><name>com blog</name><uri>http://www.blogger.com/profile/13758237633809870651</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1875536396171598176.post-6809312938198787445</id><published>2008-04-05T22:37:00.000-07:00</published><updated>2008-04-05T22:39:54.098-07:00</updated><title type='text'>Java regular expression email validations</title><content type='html'>&lt;table bg cellpadding="5" cellspacing="0" cols="1" width="100%" style="color:#c0c0c0;"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;center&gt; &lt;p&gt; &lt;span style="font-family:Arial, Helvetica;color:#000000;"&gt; JavaRegxEmailValidations.java&lt;/span&gt; &lt;/p&gt; &lt;/center&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;pre&gt;&lt;a name="l1"&gt;&lt;span class="ln"&gt;1    &lt;/span&gt;&lt;/a&gt;&lt;span class="s0"&gt;import &lt;/span&gt;&lt;span class="s1"&gt;java.util.regex.Matcher;&lt;br /&gt;&lt;a name="l2"&gt;&lt;span class="ln"&gt;2    &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s0"&gt;import &lt;/span&gt;&lt;span class="s1"&gt;java.util.regex.Pattern;&lt;br /&gt;&lt;a name="l3"&gt;&lt;span class="ln"&gt;3    &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s0"&gt;import &lt;/span&gt;&lt;span class="s1"&gt;java.util.regex.PatternSyntaxException;&lt;br /&gt;&lt;a name="l4"&gt;&lt;span class="ln"&gt;4    &lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;a name="l5"&gt;&lt;span class="ln"&gt;5    &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;/**&lt;br /&gt;&lt;a name="l6"&gt;&lt;span class="ln"&gt;6    &lt;/span&gt;&lt;/a&gt; * Created by IntelliJ IDEA.&lt;br /&gt;&lt;a name="l7"&gt;&lt;span class="ln"&gt;7    &lt;/span&gt;&lt;/a&gt; * User: Ishara Samantha&lt;br /&gt;&lt;a name="l8"&gt;&lt;span class="ln"&gt;8    &lt;/span&gt;&lt;/a&gt; * Date: Apr 6, 2008&lt;br /&gt;&lt;a name="l9"&gt;&lt;span class="ln"&gt;9    &lt;/span&gt;&lt;/a&gt; * Time: 10:34:06 AM&lt;br /&gt;&lt;a name="l10"&gt;&lt;span class="ln"&gt;10   &lt;/span&gt;&lt;/a&gt; * To change this template use File | Settings | File Templates.&lt;br /&gt;&lt;a name="l11"&gt;&lt;span class="ln"&gt;11   &lt;/span&gt;&lt;/a&gt; */&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l12"&gt;&lt;span class="ln"&gt;12   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s0"&gt;public class &lt;/span&gt;&lt;span class="s1"&gt;JavaRegxEmailValidations&lt;br /&gt;&lt;a name="l13"&gt;&lt;span class="ln"&gt;13   &lt;/span&gt;&lt;/a&gt;{&lt;br /&gt;&lt;a name="l14"&gt;&lt;span class="ln"&gt;14   &lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;a name="l15"&gt;&lt;span class="ln"&gt;15   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l16"&gt;&lt;span class="ln"&gt;16   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// &lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l17"&gt;&lt;span class="ln"&gt;17   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// Options: case insensitive&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l18"&gt;&lt;span class="ln"&gt;18   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// &lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l19"&gt;&lt;span class="ln"&gt;19   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// Assert position at a word boundary «\b»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l20"&gt;&lt;span class="ln"&gt;20   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// Match a single character present in the list below «[A-Z0-9._%+-]+»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l21"&gt;&lt;span class="ln"&gt;21   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l22"&gt;&lt;span class="ln"&gt;22   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    A character in the range between “A” and “Z” «A-Z»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l23"&gt;&lt;span class="ln"&gt;23   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    A character in the range between “0” and “9” «0-9»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l24"&gt;&lt;span class="ln"&gt;24   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    One of the characters “._%” «._%»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l25"&gt;&lt;span class="ln"&gt;25   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    The character “+” «+»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l26"&gt;&lt;span class="ln"&gt;26   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    The character “-” «-»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l27"&gt;&lt;span class="ln"&gt;27   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// Match the character “@” literally «@»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l28"&gt;&lt;span class="ln"&gt;28   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// Match a single character present in the list below «[A-Z0-9.-]+»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l29"&gt;&lt;span class="ln"&gt;29   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l30"&gt;&lt;span class="ln"&gt;30   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    A character in the range between “A” and “Z” «A-Z»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l31"&gt;&lt;span class="ln"&gt;31   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    A character in the range between “0” and “9” «0-9»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l32"&gt;&lt;span class="ln"&gt;32   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    The character “.” «.»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l33"&gt;&lt;span class="ln"&gt;33   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    The character “-” «-»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l34"&gt;&lt;span class="ln"&gt;34   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// Match the character “.” literally «\.»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l35"&gt;&lt;span class="ln"&gt;35   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// Match a single character in the range between “A” and “Z” «[A-Z]{2,4}»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l36"&gt;&lt;span class="ln"&gt;36   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;//    Between 2 and 4 times, as many times as possible, giving back as needed (greedy) «{2,4}»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l37"&gt;&lt;span class="ln"&gt;37   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="s2"&gt;// Assert position at a word boundary «\b»&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l38"&gt;&lt;span class="ln"&gt;38   &lt;/span&gt;&lt;/a&gt;    &lt;br /&gt;&lt;a name="l39"&gt;&lt;span class="ln"&gt;39   &lt;/span&gt;&lt;/a&gt;    &lt;/span&gt;&lt;span class="s0"&gt;public static void &lt;/span&gt;&lt;span class="s1"&gt;main(String[] args)&lt;br /&gt;&lt;a name="l40"&gt;&lt;span class="ln"&gt;40   &lt;/span&gt;&lt;/a&gt;    {&lt;br /&gt;&lt;a name="l41"&gt;&lt;span class="ln"&gt;41   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;ishara@gmail.com&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"ishara@gmail.com"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l42"&gt;&lt;span class="ln"&gt;42   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;ip@1.2.3.123&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"ip@1.2.3.123"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l43"&gt;&lt;span class="ln"&gt;43   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;pharaoh@egyptian.museum&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"pharaoh@egyptian.museum"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l44"&gt;&lt;span class="ln"&gt;44   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;john.doe+regexbuddy@gmail.com&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"john.doe+regexbuddy@gmail.com"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l45"&gt;&lt;span class="ln"&gt;45   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;Mike.O'Dell@ireland.com&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"Mike.O'Dell@ireland.com"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l46"&gt;&lt;span class="ln"&gt;46   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"\\\"&lt;/span&gt;&lt;span class="s3"&gt;Mike&lt;/span&gt;&lt;span class="s0"&gt;\\\\&lt;/span&gt;&lt;span class="s3"&gt; O'Dell&lt;/span&gt;&lt;span class="s0"&gt;\\\"&lt;/span&gt;&lt;span class="s3"&gt;@ireland.com&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;Mike&lt;/span&gt;&lt;span class="s0"&gt;\\&lt;/span&gt;&lt;span class="s3"&gt; O'Dell&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;@ireland.com"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l47"&gt;&lt;span class="ln"&gt;47   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;IPguy@[1.2.3.4]&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"IPguy@[1.2.3.4]"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l48"&gt;&lt;span class="ln"&gt;48   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;ishara.samantha@gmail.com&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"ishara.samantha@gmail.com"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l49"&gt;&lt;span class="ln"&gt;49   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;ishara@ac.lk&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"ishara@ac.lk"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l50"&gt;&lt;span class="ln"&gt;50   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;1024x768@60Hz&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"1024x768@60Hz"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l51"&gt;&lt;span class="ln"&gt;51   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;not.a.valid.email&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"not.a.valid.email"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l52"&gt;&lt;span class="ln"&gt;52   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;not@valid.email&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"not@valid.email"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l53"&gt;&lt;span class="ln"&gt;53   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;john@aol...com&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"john@aol...com"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l54"&gt;&lt;span class="ln"&gt;54   &lt;/span&gt;&lt;/a&gt;        System.out.println(&lt;/span&gt;&lt;span class="s3"&gt;"emailValidation(&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;Mike&lt;/span&gt;&lt;span class="s0"&gt;\\\\&lt;/span&gt;&lt;span class="s3"&gt; O'Dell@ireland.com&lt;/span&gt;&lt;span class="s0"&gt;\"&lt;/span&gt;&lt;span class="s3"&gt;) = " &lt;/span&gt;&lt;span class="s1"&gt;+ emailValidation(&lt;/span&gt;&lt;span class="s3"&gt;"Mike&lt;/span&gt;&lt;span class="s0"&gt;\\&lt;/span&gt;&lt;span class="s3"&gt; O'Dell@ireland.com"&lt;/span&gt;&lt;span class="s1"&gt;));&lt;br /&gt;&lt;a name="l55"&gt;&lt;span class="ln"&gt;55   &lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;a name="l56"&gt;&lt;span class="ln"&gt;56   &lt;/span&gt;&lt;/a&gt;    }&lt;br /&gt;&lt;a name="l57"&gt;&lt;span class="ln"&gt;57   &lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;a name="l58"&gt;&lt;span class="ln"&gt;58   &lt;/span&gt;&lt;/a&gt;    &lt;/span&gt;&lt;span class="s0"&gt;private static boolean &lt;/span&gt;&lt;span class="s1"&gt;emailValidation(String email)&lt;br /&gt;&lt;a name="l59"&gt;&lt;span class="ln"&gt;59   &lt;/span&gt;&lt;/a&gt;    {&lt;br /&gt;&lt;a name="l60"&gt;&lt;span class="ln"&gt;60   &lt;/span&gt;&lt;/a&gt;        &lt;/span&gt;&lt;span class="s0"&gt;boolean &lt;/span&gt;&lt;span class="s1"&gt;foundMatch = &lt;/span&gt;&lt;span class="s0"&gt;false&lt;/span&gt;&lt;span class="s1"&gt;;&lt;br /&gt;&lt;a name="l61"&gt;&lt;span class="ln"&gt;61   &lt;/span&gt;&lt;/a&gt;        &lt;/span&gt;&lt;span class="s0"&gt;try &lt;/span&gt;&lt;span class="s1"&gt;{&lt;br /&gt;&lt;a name="l62"&gt;&lt;span class="ln"&gt;62   &lt;/span&gt;&lt;/a&gt;            Pattern regex = Pattern.compile(&lt;/span&gt;&lt;span class="s3"&gt;"&lt;/span&gt;&lt;span class="s0"&gt;\\&lt;/span&gt;&lt;span class="s3"&gt;b[A-Z0-9._%+-]+@[A-Z0-9.-]+&lt;/span&gt;&lt;span class="s0"&gt;\\&lt;/span&gt;&lt;span class="s3"&gt;.[A-Z]{2,4}&lt;/span&gt;&lt;span class="s0"&gt;\\&lt;/span&gt;&lt;span class="s3"&gt;b"&lt;/span&gt;&lt;span class="s1"&gt;, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);&lt;br /&gt;&lt;a name="l63"&gt;&lt;span class="ln"&gt;63   &lt;/span&gt;&lt;/a&gt;            Matcher regexMatcher = regex.matcher(email);&lt;br /&gt;&lt;a name="l64"&gt;&lt;span class="ln"&gt;64   &lt;/span&gt;&lt;/a&gt;            foundMatch = regexMatcher.find();&lt;br /&gt;&lt;a name="l65"&gt;&lt;span class="ln"&gt;65   &lt;/span&gt;&lt;/a&gt;        } &lt;/span&gt;&lt;span class="s0"&gt;catch &lt;/span&gt;&lt;span class="s1"&gt;(PatternSyntaxException ex) {&lt;br /&gt;&lt;a name="l66"&gt;&lt;span class="ln"&gt;66   &lt;/span&gt;&lt;/a&gt;            &lt;/span&gt;&lt;span class="s2"&gt;// Syntax error in the regular expression&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt;&lt;a name="l67"&gt;&lt;span class="ln"&gt;67   &lt;/span&gt;&lt;/a&gt;        }&lt;br /&gt;&lt;a name="l68"&gt;&lt;span class="ln"&gt;68   &lt;/span&gt;&lt;/a&gt;        &lt;/span&gt;&lt;span class="s0"&gt;return &lt;/span&gt;&lt;span class="s1"&gt;foundMatch;&lt;br /&gt;&lt;a name="l69"&gt;&lt;span class="ln"&gt;69   &lt;/span&gt;&lt;/a&gt;    }&lt;br /&gt;&lt;a name="l70"&gt;&lt;span class="ln"&gt;70   &lt;/span&gt;&lt;/a&gt;}&lt;br /&gt;&lt;a name="l71"&gt;&lt;span class="ln"&gt;71   &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/pre&gt; &lt;pre&gt;Email address&lt;br /&gt;Use this version to seek out email addresses in random documents and texts.&lt;br /&gt;Does not match email addresses using an IP address instead of a domain name.&lt;br /&gt;Does not match email addresses on new-fangled top-level domains with more than 4 letters such as .museum. Including these increases the risk of false positives when applying the regex to random documents.&lt;br /&gt;Requires the "case insensitive" option to be ON.&lt;/pre&gt; &lt;pre&gt;&lt;span class="ln"&gt;emailValidation("ishara@gmail.com") = true&lt;br /&gt;emailValidation("ip@1.2.3.123") = false&lt;br /&gt;emailValidation("pharaoh@egyptian.museum") = false&lt;br /&gt;emailValidation("john.doe+regexbuddy@gmail.com") = true&lt;br /&gt;emailValidation("Mike.O'Dell@ireland.com") = true&lt;br /&gt;emailValidation("\"Mike\\ O'Dell\"@ireland.com") = false&lt;br /&gt;emailValidation("IPguy@[1.2.3.4]") = false&lt;br /&gt;emailValidation("ishara.samantha@gmail.com") = true&lt;br /&gt;emailValidation("ishara@ac.lk") = true&lt;br /&gt;emailValidation("1024x768@60Hz") = false&lt;br /&gt;emailValidation("not.a.valid.email") = false&lt;br /&gt;emailValidation("not@valid.email") = false&lt;br /&gt;emailValidation("john@aol...com") = true&lt;br /&gt;emailValidation("Mike\\ O'Dell@ireland.com") = true&lt;/span&gt;&lt;/pre&gt; &lt;pre&gt;&lt;span class="ln"&gt;More about email Validations as fallows&lt;/span&gt;&lt;/pre&gt; &lt;ol&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;Email address (anchored)&lt;br /&gt;Use this anchored version to check if a valid email address was entered.&lt;br /&gt;Does not match email addresses using an IP address instead of a domain name.&lt;br /&gt;Does not match email addresses on new-fangled top-level domains with more than 4 letters such as .museum.&lt;br /&gt;Requires the "case insensitive" option to be ON.&lt;/span&gt;&lt;/pre&gt;   &lt;ul&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$&lt;/span&gt;&lt;/pre&gt;     &lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;li&gt; &lt;pre&gt;Email address (anchored; no consecutive dots)&lt;br /&gt;Use this anchored version to check if a valid email address was entered.&lt;br /&gt;Improves on the original email address regex by excluding addresses with consecutive dots such as john@aol...com&lt;br /&gt;Does not match email addresses using an IP address instead of a domain name.&lt;br /&gt;Does not match email addresses on new-fangled top-level domains with more than 4 letters such as .museum. Including these increases the risk of false positives when applying the regex to random documents.&lt;br /&gt;Requires the "case insensitive" option to be ON.&lt;/pre&gt;   &lt;ul&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;^[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$&lt;/span&gt;&lt;/pre&gt;     &lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;Email address (no consecutive dots)&lt;br /&gt;Use this version to seek out email addresses in random documents and texts.&lt;br /&gt;Improves on the original email address regex by excluding addresses with consecutive dots such as john@aol...com&lt;br /&gt;Does not match email addresses using an IP address instead of a domain name.&lt;br /&gt;Does not match email addresses on new-fangled top-level domains with more than 4 letters such as .museum. Including these increases the risk of false positives when applying the regex to random documents.&lt;br /&gt;Requires the "case insensitive" option to be ON.&lt;/span&gt;&lt;/pre&gt;   &lt;ul&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b&lt;/span&gt;&lt;/pre&gt;     &lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;li&gt; &lt;pre&gt;Email address (specific TLDs)&lt;br /&gt;Does not match email addresses using an IP address instead of a domain name.&lt;br /&gt;Matches all country code top level domains, and specific common top level domains.&lt;br /&gt;Requires the "case insensitive" option to be ON.&lt;/pre&gt;   &lt;ul&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.(?:com|org|net|gov|mil|biz|info|name|aero|biz|info|mobi|jobs|museum|[A-Z]{2})$&lt;/span&gt;&lt;/pre&gt;     &lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;Email address: RFC 2822&lt;br /&gt;This regular expression implements the official RFC 2822 standard for email addresses. Using this regular expression in actual applications is NOT recommended. It is shown to illustrate that with regular expressions there's always a trade-off between what's exact and what's practical.&lt;/span&gt;&lt;/pre&gt;   &lt;ul&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;(?:[a-z0-9!#$%&amp;amp;'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&amp;amp;'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])&lt;/span&gt;&lt;/pre&gt;     &lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;Email address: RFC 2822 (simplified)&lt;br /&gt;Matches a normal email address. Does not check the top-level domain.&lt;br /&gt;Requires the "case insensitive" option to be ON.&lt;/span&gt;&lt;/pre&gt;   &lt;ul&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;[a-z0-9!#$%&amp;amp;'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&amp;amp;'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?&lt;/span&gt;&lt;/pre&gt;     &lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;Email address: RFC 2822 (specific TLDs)&lt;br /&gt;Matches all country code top level domains, and specific common top level domains.&lt;br /&gt;Requires the "case insensitive" option to be ON.&lt;/span&gt;&lt;/pre&gt;   &lt;ul&gt;&lt;li&gt; &lt;pre&gt;&lt;span class="ln"&gt;[a-z0-9!#$%&amp;amp;'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&amp;amp;'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|name|aero|biz|info|mobi|jobs|museum)\b&lt;/span&gt;&lt;/pre&gt;     &lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;/ol&gt; &lt;pre&gt; &lt;/pre&gt; &lt;pre&gt; &lt;/pre&gt; &lt;pre&gt; &lt;/pre&gt; &lt;pre&gt; &lt;/pre&gt; &lt;pre&gt; &lt;/pre&gt; &lt;pre&gt; &lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1875536396171598176-6809312938198787445?l=javaregularexpression.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaregularexpression.blogspot.com/feeds/6809312938198787445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1875536396171598176&amp;postID=6809312938198787445' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1875536396171598176/posts/default/6809312938198787445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1875536396171598176/posts/default/6809312938198787445'/><link rel='alternate' type='text/html' href='http://javaregularexpression.blogspot.com/2008/04/java-regular-expression-email.html' title='Java regular expression email validations'/><author><name>com blog</name><uri>http://www.blogger.com/profile/13758237633809870651</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1875536396171598176.post-2786170966428530953</id><published>2008-04-05T10:11:00.000-07:00</published><updated>2008-04-05T10:18:10.248-07:00</updated><title type='text'>Java Regular Expression Samples</title><content type='html'>&lt;ul&gt;&lt;li&gt;Check if the regex matches a string entirely&lt;/li&gt;&lt;li&gt;IF/else branch whether the regx matches a sring entirely&lt;/li&gt;&lt;li&gt;Create an object to use the same regx for many operations&lt;/li&gt;&lt;li&gt;Create an object to apply a regx repeatedly to a given string&lt;/li&gt;&lt;li&gt;Use regex object to test if (part of ) a string can be matched&lt;/li&gt;&lt;li&gt;Use regex object to test if a string can be match entirely&lt;/li&gt;&lt;li&gt;use regex object to get the part of a string matched by the regex&lt;/li&gt;&lt;li&gt;Use regex object to get the path of a string matched by a numbered group&lt;/li&gt;&lt;li&gt;Use regex  object to get a list of all text matched by a numbered group&lt;/li&gt;&lt;li&gt;Iterate over all matches in a string&lt;/li&gt;&lt;li&gt;Iterate over all matches and capturing groups in a string&lt;/li&gt;&lt;/ul&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.List;&lt;br /&gt;import java.util.regex.Matcher;&lt;br /&gt;import java.util.regex.Pattern;&lt;br /&gt;import java.util.regex.PatternSyntaxException;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Created by IntelliJ IDEA.&lt;br /&gt; * User: Ishara Samantha&lt;br /&gt; * Date: Apr 5, 2008&lt;br /&gt; * Time: 8:46:45 PM&lt;br /&gt; * To change this template use File | Settings | File Templates.&lt;br /&gt; */&lt;br /&gt;public class JavaRegX&lt;br /&gt;{&lt;br /&gt;    private static String subjectString;&lt;br /&gt;    private static String subjectString1;&lt;br /&gt;    private static String anotherSubjectString;&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args)&lt;br /&gt;    {&lt;br /&gt;        subjectString = "ishara@hoofoo.net";&lt;br /&gt;        anotherSubjectString = "test@hoofoo.net";&lt;br /&gt;        subjectString1 = subjectString + "," + anotherSubjectString;&lt;br /&gt;&lt;br /&gt;        //Check if the regex matches a string entirely&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            boolean foundMatch = subjectString.matches("(?i)\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b");&lt;br /&gt;            System.out.println("foundMatch = " + foundMatch);&lt;br /&gt;        } catch (PatternSyntaxException ex)&lt;br /&gt;        {&lt;br /&gt;            ex.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        //IF/else branch whether the regx matches a sring entirely&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            if (subjectString.matches("(?i)\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b"))&lt;br /&gt;            {&lt;br /&gt;                System.out.println("Match");&lt;br /&gt;            } else&lt;br /&gt;            {&lt;br /&gt;                System.out.println("Match Faild");&lt;br /&gt;            }&lt;br /&gt;        } catch (PatternSyntaxException ex)&lt;br /&gt;        {&lt;br /&gt;            // Syntax error in the regular expression&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            Pattern regex = Pattern.compile("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);&lt;br /&gt;            Matcher regexMatcher = regex.matcher(subjectString);&lt;br /&gt;&lt;br /&gt;        } catch (PatternSyntaxException ex)&lt;br /&gt;        {&lt;br /&gt;            // Syntax error in the regular expression&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            //Create an object to use the same regx for many operations&lt;br /&gt;            Pattern regex = Pattern.compile("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);&lt;br /&gt;            //Create an object to apply a regx repeatedly to a given string&lt;br /&gt;            Matcher regexMatcher = regex.matcher(subjectString);&lt;br /&gt;            //Aply the same regex to more than one string&lt;br /&gt;            regexMatcher.reset(anotherSubjectString);&lt;br /&gt;&lt;br /&gt;        } catch (PatternSyntaxException ex)&lt;br /&gt;        {&lt;br /&gt;            // Syntax error in the regular expression&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        //Use regex object to test if (part of ) a string can be matched&lt;br /&gt;        boolean foundMatch = false;&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            Pattern regex = Pattern.compile("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);&lt;br /&gt;            Matcher regexMatcher = regex.matcher(subjectString1);&lt;br /&gt;            foundMatch = regexMatcher.find();&lt;br /&gt;            System.out.println("regexMatcher = " + regexMatcher);&lt;br /&gt;            System.out.println("foundMatch = " + foundMatch);&lt;br /&gt;        } catch (PatternSyntaxException ex)&lt;br /&gt;&lt;br /&gt;        {&lt;br /&gt;            // Syntax error in the regular expression&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        //Use regex object to test if a string can be match entirely&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            Pattern regex = Pattern.compile("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);&lt;br /&gt;            Matcher regexMatcher = regex.matcher(subjectString);&lt;br /&gt;            foundMatch = regexMatcher.matches();&lt;br /&gt;            System.out.println("Use regex object to test if a string can be match entirely");&lt;br /&gt;            System.out.println("regexMatcher = " + regexMatcher);&lt;br /&gt;            System.out.println("foundMatch = " + foundMatch);&lt;br /&gt;        } catch (PatternSyntaxException ex)&lt;br /&gt;        {&lt;br /&gt;            // Syntax error in the regular expression&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        //use regex object to get the part of a string matched by the regex&lt;br /&gt;        //Use regex object to get the path of a string matched by a numbered group&lt;br /&gt;        String ResultString = null;&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            Pattern regex = Pattern.compile("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);&lt;br /&gt;            Matcher regexMatcher = regex.matcher(subjectString1);&lt;br /&gt;            if (regexMatcher.find())&lt;br /&gt;            {&lt;br /&gt;                ResultString = regexMatcher.group(0);&lt;br /&gt;                System.out.println("ResultString = " + ResultString);&lt;br /&gt;            }&lt;br /&gt;        } catch (PatternSyntaxException ex)&lt;br /&gt;        {&lt;br /&gt;            // Syntax error in the regular expression&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        //Use regex  object to get a list of all text matched by a numbered group&lt;br /&gt;        List&lt;string&gt; matchList = new ArrayList&lt;string&gt;();&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            Pattern regex = Pattern.compile("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);&lt;br /&gt;            Matcher regexMatcher = regex.matcher(subjectString1);&lt;br /&gt;            while (regexMatcher.find())&lt;br /&gt;            {&lt;br /&gt;                matchList.add(regexMatcher.group(0));&lt;br /&gt;            }&lt;br /&gt;        } catch (PatternSyntaxException ex)&lt;br /&gt;        {&lt;br /&gt;            // Syntax error in the regular expression&lt;br /&gt;        }&lt;br /&gt;        System.out.println("matchList.size() = " + matchList.size());&lt;br /&gt;&lt;br /&gt;        //Iterate over all matches in a string&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            Pattern regex = Pattern.compile("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);&lt;br /&gt;            Matcher regexMatcher = regex.matcher(subjectString);&lt;br /&gt;            while (regexMatcher.find())&lt;br /&gt;            {&lt;br /&gt;                // matched text: regexMatcher.group()&lt;br /&gt;                // match start: regexMatcher.start()&lt;br /&gt;                // match end: regexMatcher.end()&lt;br /&gt;            }&lt;br /&gt;        } catch (PatternSyntaxException ex)&lt;br /&gt;        {&lt;br /&gt;            // Syntax error in the regular expression&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        //Iterate over all matches and capturing groups in a string&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            Pattern regex = Pattern.compile("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);&lt;br /&gt;            Matcher regexMatcher = regex.matcher(subjectString);&lt;br /&gt;            while (regexMatcher.find())&lt;br /&gt;            {&lt;br /&gt;                for (int i = 1; i &lt;= regexMatcher.groupCount(); i++)&lt;br /&gt;                {&lt;br /&gt;                    // matched text: regexMatcher.group(i)&lt;br /&gt;                    // match start: regexMatcher.start(i)&lt;br /&gt;                    // match end: regexMatcher.end(i)&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        } catch (PatternSyntaxException ex)&lt;br /&gt;        {&lt;br /&gt;            // Syntax error in the regular expression&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1875536396171598176-2786170966428530953?l=javaregularexpression.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaregularexpression.blogspot.com/feeds/2786170966428530953/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1875536396171598176&amp;postID=2786170966428530953' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1875536396171598176/posts/default/2786170966428530953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1875536396171598176/posts/default/2786170966428530953'/><link rel='alternate' type='text/html' href='http://javaregularexpression.blogspot.com/2008/04/java-regular-expression-samples.html' title='Java Regular Expression Samples'/><author><name>com blog</name><uri>http://www.blogger.com/profile/13758237633809870651</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1875536396171598176.post-1135126248335447393</id><published>2008-04-01T10:24:00.000-07:00</published><updated>2008-04-01T10:25:09.127-07:00</updated><title type='text'>Using Regular Expressions in Java</title><content type='html'>&lt;h1&gt;Using Regular Expressions in Java&lt;/h1&gt; &lt;p&gt;Java 4 (JDK 1.4) and later have comprehensive support for regular expressions  through the standard &lt;tt class="code"&gt;java.util.regex&lt;/tt&gt; package. Because Java  lacked a regex package for so long, there are also many 3rd party regex packages  available for Java. I will only discuss Sun's regex library that is now part of  the JDK. Its quality is excellent, better than most of the 3rd party packages.  Unless you need to support older versions of the JDK, the &lt;tt class="code"&gt; java.util.regex&lt;/tt&gt; package is the way to go.&lt;/p&gt; &lt;p&gt;Java 5 and 6 use the same regular expression flavor (with a few minor fixes),  and provide the same regular expression classes. They add a few advanced  functions not discussed on this page.&lt;/p&gt; &lt;h2&gt;Quick Regex Methods of The String Class&lt;/h2&gt; &lt;p&gt;The Java String class has several methods that allow you to perform an  operation using a regular expression on that string in a minimal amount of code.  The downside is that you cannot specify options such as "case insensitive" or  "dot matches newline". For performance reasons, you should also not use these  methods if you will be using the same regular expression often.&lt;/p&gt; &lt;p&gt;&lt;tt class="code"&gt;myString.matches("regex")&lt;/tt&gt; returns true or false  depending whether the string can be matched entirely by the regular expression.  It is important to remember that String.matches() only returns true if the  entire string can be matched. In other words: "regex" is applied as if you had  written "^regex$" with start and end of string anchors. This is different from  most other regex libraries, where the "quick match test" method returns true if  the regex can be matched anywhere in the string. If myString is &lt;tt class="string"&gt;abc&lt;/tt&gt; then &lt;tt class="code"&gt;myString.matches("bc")&lt;/tt&gt;  returns false. &lt;tt class="regex"&gt;bc&lt;/tt&gt; matches &lt;tt class="string"&gt;abc&lt;/tt&gt;,  but &lt;tt class="regex"&gt;^bc$&lt;/tt&gt; (which is really being used here) does not.&lt;/p&gt; &lt;p&gt;&lt;tt class="code"&gt;myString.replaceAll("regex", "replacement")&lt;/tt&gt; replaces  all regex matches inside the string with the replacement string you specified.  No surprises here. All parts of the string that match the regex are replaced.  You can use the contents of capturing parentheses in the replacement text via  $1, $2, $3, etc. $0 (dollar zero) inserts the entire regex match. $12 is  replaced with the 12th backreference if it exists, or with the 1st backreference  followed by the literal "2" if there are less than 12 backreferences. If there  are 12 or more backreferences, it is not possible to insert the first  backreference immediately followed by the literal "2" in the replacement text.&lt;/p&gt; &lt;p&gt;In the replacement text, a dollar sign not followed by a digit causes an  IllegalArgumentException to be thrown. If there are less than 9 backreferences,  a dollar sign followed by a digit greater than the number of backreferences  throws an IndexOutOfBoundsException. So be careful if the replacement string is  a user-specified string. To insert a dollar sign as literal text, use &lt;tt&gt;\$&lt;/tt&gt;  in the replacement text. When coding the replacement text as a literal string in  your source code, remember that the backslash itself must be escaped too: &lt;tt&gt; "\\$"&lt;/tt&gt;.&lt;/p&gt; &lt;p&gt;&lt;tt class="code"&gt;myString.split("regex")&lt;/tt&gt; splits the string at each regex  match. The method returns an array of strings where each element is a part of  the original string between two regex matches. The matches themselves are not  included in the array. Use &lt;tt class="code"&gt;myString.split("regex", n)&lt;/tt&gt; to  get an array containing at most n items. The result is that the string is split  at most n-1 times. The last item in the string is the unsplit remainder of the  original string.&lt;/p&gt; &lt;h2&gt;Using The Pattern Class&lt;/h2&gt; &lt;p&gt;In Java, you compile a regular expression by using the &lt;tt class="code"&gt; Pattern.compile()&lt;/tt&gt; class factory. This factory returns an object of type &lt;tt class="code"&gt;Pattern&lt;/tt&gt;. E.g.: &lt;tt class="code"&gt;Pattern myPattern =  Pattern.compile("regex");&lt;/tt&gt; You can specify certain options as an optional  second parameter. &lt;tt class="code"&gt;Pattern.compile("regex",  Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE)&lt;/tt&gt; makes the  regex case insensitive for US ASCII characters, causes the dot to match line  breaks and causes the start and end of string anchors to match at embedded line  breaks as well. When working with Unicode strings, specify &lt;tt class="code"&gt; Pattern.UNICODE_CASE&lt;/tt&gt; if you want to make the regex case insensitive for all  characters in all languages. You should always specify &lt;tt class="code"&gt; Pattern.CANON_EQ&lt;/tt&gt; to ignore differences in Unicode encodings, unless you are  sure your strings contain only US ASCII characters and you want to increase  performance.&lt;/p&gt; &lt;p&gt;If you will be using the same regular expression often in your source code,  you should create a &lt;tt class="code"&gt;Pattern&lt;/tt&gt; object to increase  performance. Creating a &lt;tt class="code"&gt;Pattern&lt;/tt&gt; object also allows you to  pass matching options as a second parameter to the &lt;tt class="code"&gt; Pattern.compile()&lt;/tt&gt; class factory. If you use one of the &lt;tt class="code"&gt; String&lt;/tt&gt; methods above, the only way to specify options is to embed mode  modifier into the regex. Putting &lt;tt class="regex"&gt;(?i)&lt;/tt&gt; at the start of the  regex makes it case insensitive. &lt;tt class="regex"&gt;(?m)&lt;/tt&gt; is the equivalent  of &lt;tt class="code"&gt;Pattern.MULTILINE&lt;/tt&gt;, &lt;tt class="regex"&gt;(?s)&lt;/tt&gt; equals &lt;tt class="code"&gt;Pattern.DOTALL&lt;/tt&gt; and &lt;tt class="regex"&gt;(?u)&lt;/tt&gt; is the same  as &lt;tt class="code"&gt;Pattern.UNICODE_CASE&lt;/tt&gt;. Unfortunately, &lt;tt class="code"&gt; Pattern.CANON_EQ&lt;/tt&gt; does not have an embedded mode modifier equivalent.&lt;/p&gt; &lt;p&gt;Use &lt;tt class="code"&gt;myPattern.split("subject")&lt;/tt&gt; to split the subject  string using the compiled regular expression. This call has exactly the same  results as &lt;tt class="code"&gt;myString.split("regex")&lt;/tt&gt;. The difference is that  the former is faster since the regex was already compiled.&lt;/p&gt; &lt;h2&gt;Using The Matcher Class&lt;/h2&gt; &lt;p&gt;Except for splitting a string (see previous paragraph), you need to create a &lt;tt class="code"&gt;Matcher&lt;/tt&gt; object from the &lt;tt class="code"&gt;Pattern&lt;/tt&gt;  object. The &lt;tt class="code"&gt;Matcher&lt;/tt&gt; will do the actual work. The advantage  of having two separate classes is that you can create many &lt;tt class="code"&gt; Matcher&lt;/tt&gt; objects from a single &lt;tt class="code"&gt;Pattern&lt;/tt&gt; object, and  thus apply the regular expression to many subject strings simultaneously.&lt;/p&gt; &lt;p&gt;To create a &lt;tt class="code"&gt;Matcher&lt;/tt&gt; object, simply call &lt;tt class="code"&gt;Pattern.matcher()&lt;/tt&gt; like this: &lt;tt class="code"&gt;myMatcher =  Pattern.matcher("subject")&lt;/tt&gt;. If you already created a &lt;tt class="code"&gt; Matcher&lt;/tt&gt; object from the same pattern, call &lt;tt class="code"&gt; myMatcher.reset("newsubject")&lt;/tt&gt; instead of creating a new matcher object, for  reduced garbage and increased performance. Either way, &lt;tt class="code"&gt; myMatcher&lt;/tt&gt; is now ready for duty.&lt;/p&gt; &lt;p&gt;To find the first match of the regex in the subject string, call &lt;tt class="code"&gt;myMatcher.find()&lt;/tt&gt;. To find the next match, call &lt;tt class="code"&gt;myMatcher.find()&lt;/tt&gt; again. When &lt;tt class="code"&gt; myMatcher.find()&lt;/tt&gt; returns false, indicating there are no further matches,  the next call to &lt;tt class="code"&gt;myMatcher.find()&lt;/tt&gt; will find the first  match again. The &lt;tt class="code"&gt;Matcher&lt;/tt&gt; is automatically reset to the  start of the string when &lt;tt class="code"&gt;find()&lt;/tt&gt; fails.&lt;/p&gt; &lt;p&gt;The &lt;tt class="code"&gt;Matcher&lt;/tt&gt; object holds the results of the last match.  Call its methods &lt;tt class="code"&gt;start()&lt;/tt&gt;, &lt;tt class="code"&gt;end()&lt;/tt&gt; and &lt;tt class="code"&gt;group()&lt;/tt&gt; to get details about the entire regex match and  the matches between capturing parentheses. Each of these methods accepts a  single int parameter indicating the number of the backreference. Omit the  parameter to get information about the entire regex match. &lt;tt class="code"&gt; start()&lt;/tt&gt; is the index of the first character in the match. &lt;tt class="code"&gt; end()&lt;/tt&gt; is the index of the first character after the match. Both are  relative to the start of the subject string. So the length of the match is &lt;nobr&gt; &lt;tt class="code"&gt;end() - start()&lt;/tt&gt;&lt;/nobr&gt;. &lt;tt class="code"&gt;group()&lt;/tt&gt;  returns the string matched by the regular expression or pair of capturing  parentheses.&lt;/p&gt; &lt;p&gt;&lt;tt class="code"&gt;myMatcher.replaceAll("replacement")&lt;/tt&gt; has exactly the  same results as &lt;tt class="code"&gt;myString.replaceAll("regex", "replacement")&lt;/tt&gt;.  Again, the difference is speed.&lt;/p&gt; &lt;p&gt;The &lt;tt class="code"&gt;Matcher&lt;/tt&gt; class allows you to do a search-and-replace  and compute the replacement text for each regex match in your own code. You can  do this with the &lt;tt class="code"&gt;appendReplacement()&lt;/tt&gt; and &lt;tt class="code"&gt; appendTail()&lt;/tt&gt; Here is how:&lt;/p&gt; &lt;pre&gt;StringBuffer myStringBuffer = &lt;span class="reservedword"&gt;new&lt;/span&gt; StringBuffer();&lt;br /&gt;myMatcher = myPattern.matcher(&lt;span class="characterstring"&gt;"subject"&lt;/span&gt;);&lt;br /&gt;&lt;span class="reservedword"&gt;while&lt;/span&gt; (myMatcher.find()) &lt;span class="bracket"&gt;{&lt;/span&gt;&lt;br /&gt; &lt;span class="reservedword"&gt;if&lt;/span&gt; (checkIfThisMatchShouldBeReplaced()) &lt;span class="bracket"&gt;{&lt;/span&gt;&lt;br /&gt;   myMatcher.appendReplacement(myStringBuffer, computeReplacementString());&lt;br /&gt; &lt;span class="bracket"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="bracket"&gt;}&lt;/span&gt;&lt;br /&gt;myMatcher.appendTail(myStringBuffer);&lt;/pre&gt; &lt;p&gt;Obviously, &lt;tt class="code"&gt;checkIfThisMatchShouldBeReplaced()&lt;/tt&gt; and &lt;tt class="code"&gt;computeReplacementString()&lt;/tt&gt; are placeholders for methods  that you supply. The first returns true or false indicating if a replacement  should be made at all. Note that skipping replacements is way faster than  replacing a match with exactly the same text as was matched. &lt;tt class="code"&gt; computeReplacementString()&lt;/tt&gt; returns the actual replacement string.&lt;/p&gt; &lt;h2&gt;Regular Expressions, Literal Strings and Backslashes&lt;/h2&gt; &lt;p&gt;In literal Java strings the backslash is an escape character. The literal  string &lt;tt class="code"&gt;"\\"&lt;/tt&gt; is a single backslash. In regular expressions,  the backslash is also an escape character. The regular expression &lt;tt class="regex"&gt;\\&lt;/tt&gt; matches a single backslash. This regular expression as  a Java string, becomes &lt;tt class="code"&gt;"\\\\"&lt;/tt&gt;. That's right: 4 backslashes  to match a single one.&lt;/p&gt; &lt;p&gt;The regex &lt;tt class="regex"&gt;\w&lt;/tt&gt; matches a word character. As a Java  string, this is written as &lt;tt class="code"&gt;"\\w"&lt;/tt&gt;.&lt;/p&gt; &lt;p&gt;The same backslash-mess occurs when providing replacement strings for methods  like String.replaceAll() as literal Java strings in your Java code. In the  replacement text, a dollar sign must be encoded as \$ and a backslash as \\ when  you want to replace the regex match with an actual dollar sign or backslash.  However, backslashes must also be escaped in literal Java strings. So a single  dollar sign in the replacement text becomes &lt;tt class="code"&gt;"\\$"&lt;/tt&gt; when  written as a literal Java string. The single backslash becomes &lt;tt class="code"&gt; "\\\\"&lt;/tt&gt;. Right again: 4 backslashes to insert a single one.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1875536396171598176-1135126248335447393?l=javaregularexpression.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaregularexpression.blogspot.com/feeds/1135126248335447393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1875536396171598176&amp;postID=1135126248335447393' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1875536396171598176/posts/default/1135126248335447393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1875536396171598176/posts/default/1135126248335447393'/><link rel='alternate' type='text/html' href='http://javaregularexpression.blogspot.com/2008/04/using-regular-expressions-in-java.html' title='Using Regular Expressions in Java'/><author><name>com blog</name><uri>http://www.blogger.com/profile/13758237633809870651</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
