Note that there are some explanatory texts on larger screens.

plurals
  1. POMatch url with the pattern
    primarykey
    data
    text
    <p>I am opening a filters.txt file. Below is the file:</p> <pre><code>http://www.somehost.com/.*/releases, RE,TO </code></pre> <p>I am comparing the first entry in the text file with the hard coded url in my code. Any URL that starts with the pattern(firstentry) in the text file should do this in particular if loop. Here this url <code>http://www.somehost.com/news/releases/2011/09/07/somehost-and-life-care-networks-launch-3g-mobile-health-project-help-patien</code> is originated from this pattern url only <code>http://www.somehost.com/.*/releases</code>. But still it is not matching this pattern. Any suggestions why is it happening?</p> <pre><code>BufferedReader readbuffer = null; try { readbuffer = new BufferedReader(new FileReader("filters.txt")); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String strRead; try { while ((strRead=readbuffer.readLine())!=null){ String splitarray[] = strRead.split(","); String firstentry = splitarray[0]; String secondentry = splitarray[1]; String thirdentry = splitarray[2]; Pattern p = Pattern.compile("^" +firstentry); Matcher m = p.matcher("http://www.somehost.com/news/releases/2011/09/07/somehost-and-life-care-networks-launch-3g-mobile-health-project-help-patien"); if (m.find() &amp;&amp; thirdentry.startsWith("LO")) { //Do whatever System.out.println("First Loop"); } else if(m.find() &amp;&amp; thirdentry.startsWith("TO")) { System.out.println("Second Loop"); } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload