This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes Trouble reading the regex value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Trouble reading the regex value" Watch "Trouble reading the regex value" New topic
Author

Trouble reading the regex value

mj zammit
Ranch Hand

Joined: Nov 16, 2008
Posts: 49
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

Joined: Nov 16, 2008
Posts: 49
solved it...had to do a while loop so with every match i found i show it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trouble reading the regex value
 
Similar Threads
Regular expression
matcher.matches()
If only one vowel is entered in the string, then that vowel should be diplayed on console
Struggling with String Processing task
Parsing and Reformatting