0

i have a question :

I want to create an app that take a String from user input. This String will be in an email format. So there's some requirement's :

  1. .(full stop) can't be placed before @
  2. .(full stop) and @ can't be more than one
  3. .(full stop) and @ can't be side by side

Note : This is NOT a school homework(i just felt that this is like a homework after i typed it), i just want to learn more about String :D

I already did some research's but i still can't solve those problem's :D

Thanks all, and sory if i made some mistake's, English is not my native languange :D

3
  • 1
    Why would you want to prevent 'dot' from appearing before @? it is valid. Commented Feb 28, 2012 at 13:17
  • Hm...yes i made a mistake, i think it's invalid :D But it's okay, coz i think the first is the hardest one :D Commented Feb 28, 2012 at 13:24
  • Please help if you have some free time! Thanks :D Commented Mar 1, 2012 at 9:19

1 Answer 1

3

This is Universal Email Validation For Email

 if(eMailValidation(YourEmailString)){
          /// right  Email-id
      }
    public boolean eMailValidation(String emailstring) {
            Pattern emailPattern = Pattern.compile(".+@.+\\.[a-z]+");
            Matcher emailMatcher = emailPattern.matcher(emailstring);
            return emailMatcher.matches();
        }
Sign up to request clarification or add additional context in comments.

5 Comments

Thanks Sir :D If possible, i want to get the "manual" one..coz i want to know it's syntax and how to implement them :D And i will have to change some requirement's so it's not just like a normal email Thank you Sir :D
what you want actually ? i cant understand?
Sorry :D Hm..maybe like using some loop's and if's and then using some method's like isDigit or isSpace in C :D
Hm..yes..i mean i want to check it in that way.. Like : for (int i = 0; i < strlen(example); i++){ if(isDigit(example[i]))return 0; } It's something like that, i called it manually :D THanks Sir :D
well, i want to check those 3 requrement's...the isDigit is just for example :D Do you understand what i mean?he2 Sorry Sir, English is not my native languange :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.