fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.regex.Matcher;
  7. import java.util.regex.Pattern;
  8.  
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. String regex = "https?:\\\\?/\\\\?/\\S+";
  14. String string = "http:/\\/books.google.com\\/books\\/content?id=0DwKEBD5ZBUC&printsec=frontcover&img=1&zoom=5&source=gbs_api";
  15. if(string.matches(regex)) {
  16. System.out.println(string.replace("\\/", "/"));
  17. }
  18. }
  19. }
Success #stdin #stdout 0.08s 48340KB
stdin
Standard input is empty
stdout
http://books.google.com/books/content?id=0DwKEBD5ZBUC&printsec=frontcover&img=1&zoom=5&source=gbs_api