What is the easiest way to construct a java regular expression and pass it to a method that expects a String? Ideally something similar to SO JavaScript solution here.
System.out.println(System.getProperty(/* Regex here*/));
What is the easiest way to construct a java regular expression and pass it to a method that expects a String? Ideally something similar to SO JavaScript solution here.
System.out.println(System.getProperty(/* Regex here*/));
What is the easiest way to construct a java regular expression and pass it to a method that expects a String?
You can't. You can only use regular expressions with methods that are written to accept them, you can't use them with any method that just accepts a string (such as System.getProperty).
Methods accepting regular expressions, either explicitly as Pattern instances or implicitly as strings (like String#replaceAll), will say clearly that they do in their JavaDoc.
System.getProperties(), save to a List or a map, loop through it and match?