Posts

Showing posts from June, 2012

Get email ids from a given text or email corpora using Regex and Java

Here is the example to get all email ids from a email corpora or text: package com.Nur; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Emailvalidation {     /**      * @param args      * @author nur.haldar      * @return      */     public static final String EXAMPLE_TEST = "This is the emailid: nur.haldar@comviva.com" +             " from where" +             " the mail was sent to NURJAMIA@gmail.com. Please check " +             "the two email ids are valid or not";     public static void main(String[] args) {         String regex = "\\b[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}\\b";         Pattern pattern = Pattern.compile(regex);                 Matcher matcher = pattern.matcher(EXAMPLE_TEST);         System.out.println("Below are the email ids found in the text:");         while(matcher.find()){             System.out.println("Email Ids: "+matcher.g

Check valid Email Id using Regex in Java

Any email id is of the form: abc.xyz@company.com or abc23.xyz@company.co.uk or abc_34year@company.com . One can validate these emails using regular expression in Java. Below is a program which can replace the email ids with a word 'EMAIL'. package com.Nur; public class Emailvalidation {     /**      * @param args      * @author nur.haldar      * @return      */     public static final String EXAMPLE_TEST = "This is the emailid: nur.haldar@comviva.com" +             " from where" +             " the mail was sent to nurjamia@gmail.com. Please check " +             "the two email ids are valid or not";     public static void main(String[] args) {         //String nameRegex = "[A-Z][a-z]+\s\s?[A-Z][\.]?\s\s?[A-Z][a-z]+";         String pattern = "(\\w)(\\s+)([\\.,])";         pattern = "\\b[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}\\b";         System.out.println(EXAMPLE_TEST.replaceAll(pattern, "

Regular Expression in Java

Quick Study of Regex: Common Syntax to be remember: Regular Expression Description . Matches any sign ^regex regex must match at the beginning of the line regex$ Finds regex must match at the end of the line [abc] Set definition, can match the letter a or b or c

Free Download "Tomay Chara Ghum Asena Maa" Ringtone

Ringtone of Maa serial Title song: Please visit the below link. https://docs.google.com/file/d/0B3UM79zo-HUHTzAxNFRUVkVVem8/edit Thanks for download. And please don't forget to comment here.