• 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

Extracting subStrings from String

 
Ranch Hand
Posts: 391
1
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this String
String a=Title abu dhabi ipl season 7 Description The ground located in Abu Dhabi is one of the three IPL venues in UAE this season Link http://indiatoday.intoday.in/story/ipl-2014-venues-sheikh-zayed-stadium-indian-premier-league-7/1/355264.html Title IPL 7 team guides: Sunrisers Hyderabad | The National Description Abu Dhabi fans celebrate Pacquiao victory over Bradley; ... IPL 7 team guides: ... Hyderabad?s UAE schedule. v Rajasthan Royals, Abu Dhabi, April 18. v Kings XI ... Link http://www.thenational.ae/sport/indian-premier-league-(ipl)/ipl-7-team-guides-sunrisers-hyderabad Title Report: Star Wars Episode 7 to Partially Film in Abu Dhabi ... Description ... Star Wars Episode 7 to Partially Film in Abu Dhabi ?R2-D2 Does ... Episode VII will film in Abu Dhabi, ... Da Vinci's Demons Season 2 ... Link http://www.ign.com/articles/2014/04/11/report-star-wars-episode-vii-to-partially-film-in-abu-dhabi Title IPL 7: Season Preview ? Kings XI Punjab - Yahoo Cricket ... Description Read 'IPL 7: Season Preview ? Kings XI Punjab' on Yahoo Cricket India. Kings XI Punjab: Season Preview. ... Abu Dhabi, United Arab Emirates. Link https://cricket.yahoo.com/news/ipl-7-season-preview-kings-151902960.html

From this I want to store All I title into title array
All Description into description array
and All link into link array.

 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...and your question is?

Generally, you won't find much help unless you ask specific, focused questions. We expect you to show some effort, and TRY to do it your self. Post your actual code. Tell us what works and what doesn't work (and why you expected it to do).

Explain in detail what the problem is you are trying to solve, and how you are trying to solve it.

I would also suggest you stop coding, and sit down with some paper and pencils and work through how YOU would do this, if you were trying to do it by hand. What SPECIFICALLY constitutes a title, a description, and a link? Your instructions should be detailed enough that a child could follow them and not have any questions.
 
Mahtab Alam
Ranch Hand
Posts: 391
1
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you see first Line of the String

Title abu dhabi ipl season 7 Description The ground located in Abu Dhabi is one of the three IPL venues in UAE this season Link http://indiatoday.intoday.in/story/ipl-2014-venues-sheikh-zayed-stadium-indian-premier-league-7/1/355264.html



Anything that is between word Title and Description is Title
Anything that comes between Description and Link is Description
And Anything that comes from Link and next Title is Link

I want to extract these titles,descriptions and links and store them in there respective arrays or lists.

How I can do that , what regex can do that ?
 
fred rosenberger
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mahtab Alam wrote:How I can do that , what regex can do that ?


Slow down there, partner.

if you are here in your analysis, and you're already asking "how do I use this specific technology to accomplish my goal", then you are NOT done analyzing the problem. You are effectively saying "How do I use some pliers to build a house?"

You may indeed need pliers to build a house - but you may not. You need to understand everything, and that takes time, your brain, and usually a lot of paper, pencils and erasing.

One thing that I immediately notice wrong with this:

And Anything that comes from Link and next Title is Link


is that you will NEVER get the last link, since there is NEVER the word "TITLE" after it.

You also have issues if the description has the word "link" in it. A move about golf may indeed refer to "the Links". A movie about royalty may describe someone being granted a Title. How do you plan on handling these situation?
reply
    Bookmark Topic Watch Topic
  • New Topic