• Post Reply Bookmark Topic Watch Topic
  • New Topic

library to extract text ?  RSS feed

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do we have an library to extract text based on condition ? for example, I have a line of string:

718-333-4444/// help@ddd.com /// www.ddd.com ///Eol Kerne

then I need to get email address, website, telephone and contact name.

Thanks.
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are looking for regex.
 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouter Oet wrote:You are looking for regex.


regex is the way to search, not extract.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edward Chen wrote:regex is the way to search, not extract.

Think again.

But you might also be able to simply use String.split().
 
Mohamed Sanaulla
Bartender
Posts: 3185
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edward Chen wrote:
regex is the way to search, not extract.


I think its possible to extract the String.
 
Mohamed Sanaulla
Bartender
Posts: 3185
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:But you might also be able to simply use String.split().


+1 For split()
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Edward Chen wrote:regex is the way to search, not extract.

Think again.

But you might also be able to simply use String.split().

... which takes a regex argument
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohamed sanaullah wrote:
Edward Chen wrote:
regex is the way to search, not extract.

I think its possible to extract the String.

It is most certainly possible to use regular expressions to extract matching substrings.

Darryl Burke wrote:
Bear Bibeault wrote:
But you might also be able to simply use String.split().

... which takes a regex argument

But has nothing to do with the use of regular expressions to extract substrings. It's merely a way to express the separator in a flexible manner. They're kind of the inverse of each other.
 
Malatesh Karabisti
Ranch Hand
Posts: 153
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

output :

718-333-4444
help@ddd.com
www.ddd.com
Eol Kerne

Email Id is help@ddd.com

Hope this helps
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!