Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Find a dot in a string
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; import java.util.regex.Matcher; import java.util.regex.Pattern; class Rextester { final static String regex = "^[\\/\\.].*$"; final static String[] stringsToTest = { ".file", "./file", "/file", "/.file", ".", "./", "/some/path", "/some-path/.some-file", "/path/path/.file", "/path/.file", "/asfas/.d", "/path/.file" }; final static Pattern pattern = Pattern.compile(regex); public static void main(String[] args) { for (String text : stringsToTest) { testRegex(text); } } public static void testRegex(String testString) { Matcher matcher = pattern.matcher(testString); while (matcher.find()) { System.out.println("Full match: " + matcher.group(0)); for (int i = 1; i <= matcher.groupCount(); i++) { System.out.println("Group " + i + ": " + matcher.group(i)); } } } }
run
|
edit
|
history
|
help
0
Convert string array to lowercase.
LRU cache - Using doubly linked list (Fast!)
Use of JS in Java (not my)
3c
Rextester.java
MinMaxArray
4.b
right swastik
// Java Coding Challenge - 08: Reversing a Number using Mathematical Operations
karyawan