fork download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. final String text = "This is param-start ?abcdef; param-end";
  11. final String patternString = "(['\"]?)\\?.*?;\\1";
  12. final Pattern pattern = Pattern.compile(patternString, Pattern.DOTALL);
  13. final Matcher matcher = pattern.matcher(text);
  14. while (matcher.find()) {
  15. System.out.println("Match found: " + matcher.group());
  16. }
  17. }
  18. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
Match found: ?abcdef;