Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java regex check if group exists

String  text    = "asdf 2013-05-12 asdf";
String  regex   = ".+?([0-9]{4}s?-s?[0-9]{2}s?-s?[0-9]{2}).+";
Matcher matcher = Pattern.compile(regex).matcher(text);

if (matcher.matches()) {
    String matchedGroup = matcher.group(1);
    System.out.println(matchedGroup);
}
Comment

PREVIOUS NEXT
Code Example
Java :: what singleton java spring 
Java :: geometric primitive 
Java :: math ceil java 
Java :: Meditation for stress and depression 
Java :: android how to change focus on confirm button on keyboard 
Java :: comment initialiser un tableau de char en java 2d array 
Java :: how to wirte an XPlane Plugin 
Java :: Returning an Array from a Method 
Java :: Check if service running in the background 
Java :: IMEI DEVISE ANDROID JAVA 
Java :: zombie testing java 
Java :: Java Using Looping Construct to Copy Arrays 
Java :: java interview question answer 
Java :: How to pass ArrayList of Objects from one to another activity using Intent in android? 
Java :: remove minimum element from stack java 
Java :: why left+(right-left)/2 will not overflow? 
Java :: system.out.println int in java concatenate 
Java :: add two numbers in java 
Java :: Java Constructor invocations 
Java :: Kotlin is like java 
Java :: centrar valores en celda jtable java netbeans 
Java :: how to extract value from payload in java 
Java :: hint property of plain text in android studio 
Java :: Double And Char In Java 
Java :: make for on all variable in class in java 
Java :: hide tablayout tab android 
Java :: java union of sets 
Java :: how to shorten if else if and else in java 
Java :: java 8 anymatch two lists 
Java :: change button background drawable in code 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =