This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble reading the regex value

 
mj zammit
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have the following code, where i parse an html text and use a regex to get all the src attribute values.
The regex works fine on a subset of sites.
My problem is reading the values the regex found...it always gives me an error.
The error is the following
Exception in thread "main" java.lang.IllegalStateException: No match found
at java.util.regex.Matcher.group(Matcher.java:468)
at java.util.regex.Matcher.group(Matcher.java:428)
at httpclientregex.Main.main(Main.java:52)
Java Result: 1


And the code is as following


Am i missing something??

Any suggestions would be greatly appreciated
 
mj zammit
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
solved it...had to do a while loop so with every match i found i show it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic