Unstoppable Domains

Anyone done any regex in java? Need a bit help

Spaceship Spaceship
Watch

Jawn

Straight from SwedenEstablished Member
Impact
2
Hi im trying to crawl some little info from a website but i cant seem to get out the information i want.

Code:
import java.io.*;
import java.net.*;
import java.util.regex.*;

class Stryktips {

	public static void main(String[] args) throws Exception{

		URL u = new URL("http://svt.se/svttext/web/pages/551.html");

		URLConnection uc = u.openConnection();

		uc.setDoInput(true);

		uc.connect();

		BufferedReader in = new BufferedReader (new InputStreamReader(uc.getInputStream()));

		String i = in.readLine();



		//String regex = "class=\"C\">(.*?)</span>";
		//String regex = "([0-9]{1,4})";
		String regex = "<span class=\"C\">(.*?)</span>";

		Pattern pattern = Pattern.compile(regex);


		Matcher matcher = pattern.matcher(i);


   		while (matcher.find()) {
   		  System.out.println("Found a match: " + matcher.group());
   		  System.out.println("Start position: " + matcher.start());
    	  System.out.println("End position: " + matcher.end());
   		}


	}

}


Cant can the pattern to work

String regex = "<span class=\"C\">(.*?)</span>";


This is how the html looks like


<span class="C"> 4. Middlesbr-Bolton 5-1 </span>


Would appreciate if someone could help


Best Regards
Jawn
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
no one ? :(
 
0
•••
0
•••
Didnt work :/ cant understand why
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back