• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to retrive more than one match  RSS feed

 
pradipta kumar rout
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir,

I want to retrive some patterns from a text file.
My requirement is that I want to retrive more than one type of pattern from that text file.

so how to create a regex pattern that work for it

example :

supose I a want to retrive

(a) how are you
(B)good afternoon

that is in between <title></title> and <body></body> tags of following file


supose the file is : it is ljlkj alkfj asdfjal <title> how are you </title> jdfkajdgfkja

fadfakjdhfkajhfk <body>good afternoon</body>

I can able to retrive only one at a time either the string between title tag or body but i want multiple pattern should retrive in at a time.
I want to retrive multiple pattern by using regex ,so how to do this

Kindly help me

Thank you
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried so far? Why did it fail? Please ShowSomeEffort
 
pradipta kumar rout
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir,
I have tried folloings

1.
The above code snippet giving me the Title

I can have aoption to retrive strings between <head> tag as follow

2.

The above code snippet giving me the head.

But the problem is that I am not able to retrive both of above by a single pattern regex,I have to use 1 for title and 2 for body ,I am not able to retrive in a single run of the program, i have to change the regex then compile and then the result is coming.
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you find an XML parser? What about (Title|head)?

I think this question is too difficult for "beginning" so shall move this thread.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!