• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

library to extract text ?

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are looking for regex.
 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Wouter Oet wrote:You are looking for regex.



regex is the way to search, not extract.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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().
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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



+1 For split()
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 153
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic