This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes help me for validation of email address using regex Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help me for validation of email address using regex" Watch "help me for validation of email address using regex" New topic
Author

help me for validation of email address using regex

Raveendra Mutyala
Greenhorn

Joined: Sep 10, 2005
Posts: 13
hi friends ,
can any one help me in solving the errors for validation email address using the code or any other code if other had u can send me if u like..

this code is there in http://java.sun.com/developer/technicalArticles/releases/1.4regex/
but it is not working..

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

What's broken about it? Also, what version of java are you using? I've seen this code (as well as many variations on it such as in PHP) and it usually works pretty well.


My Blog: Down Home Country Coding with Scott Selikoff
Raveendra Mutyala
Greenhorn

Joined: Sep 10, 2005
Posts: 13
hi i am using Websphere studio application development 5.1.2 version .
it is giving error at p.matcher(input);

Error:
The method matcher(CharSequence) in the type Pattern is not applicable for the arguments (String)EmailValidation.java

so kindly can u suggest me the solution to solve this problem.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

What are your import statements? It sounds like you're not using the correct String or Pattern class, as all Strings implement CharSequence interface.
Raveendra Mutyala
Greenhorn

Joined: Sep 10, 2005
Posts: 13
Originally posted by Scott Selikoff:
What are your import statements? It sounds like you're not using the correct String or Pattern class, as all Strings implement CharSequence interface.
import java.util.regex.*; is the only import statement i used in my program.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

Hmm, is it possible your JVM is set to 1.3? According to the API CharSequence has really only been around since 1.4 so any 1.3 versions of java.lang.String would give the error you're seeing. I'd check your class path and jvm properties.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help me for validation of email address using regex
 
Similar Threads
RegularExpression for string replacement
java.util.regex package
Searching and replacing text in a string
java.util.regex.PatternSyntax Exception
Need help in creating reg expression