Chris Zhang
Chris Zhang

Reputation: 968

Finding substrings in a string (HTML, Android)

Working with Android, I am trying to make my activity go to this website

http://busvc.blogspot.com/p/about.html

and obtain all the email addresses to be put in a string array.

What I had in mind was to look at the HTML of the page as a String and find all substrings that come before the @ (email symbol) and after a > character.

Any ideas will be appreciated.

EDIT: I realize this won't work completely as the email address esmall is actually separated by HTML formatting from the @binghamton.edu part. This is a new problem. Need answers.

Upvotes: 0

Views: 133

Answers (1)

Juned Ahsan
Juned Ahsan

Reputation: 68715

Using an email regex will be a better idea, use pattern Matcher with the following regex(you may correct regex in case any flaws found):

^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*
      @[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$;

Hope you should be able to code using this info.

Upvotes: 1

Related Questions