I don't understand why this Regex return false in Java [duplicate]

This question already has an answer here:

Difference between matches() and find() in Java Regex

5 answers

I try to write a simple Regex to practice, the code below is supposed to output TRUE I think?

But the output is false, can anyone tell me?

import java.util.regex.Matcher;

import java.util.regex.Pattern;

public class test {

public static void main(String[] args) {

boolean result = Pattern.matches("[a-z]*(?=ing)", "dancing");

System.out.println(result);

}}...

Read More »

By: StackOverFlow - 5 days ago

Related Posts