• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use Scanner and reg exp to break up string  RSS feed

 
Shane Lee
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use Scanner to break up a string that i read in from file.
File data is:


The steps i need to do are:
Get length from :28 to </n0:message>
Prefix this length to before :28 and get rid of the rest

is there a regular expression i can call to get string token from :28 to </n0:message>?
So far i have a delimiter to get string token from :28 but i dont know how to stop at </n0:message>.


This allows me to include the delimiter which i want, but if i wanted to try and include the delimiter but at the end of the token instead of the start how can i achieve this.



If i run this my data will be like:


All i want from my raw data is three tokens:


I hope i havent made this too confusing!

Thanks,
Shane.

 
Shane Lee
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems to work.


 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!