R
R
Rienopely2015-09-16 13:14:19
Java
Rienopely, 2015-09-16 13:14:19

I know I'm an idiot. But why is the regular expression hitting me with False?

Pattern pattern = Pattern.
                compile("a");
        Matcher a = pattern.matcher("HelsssaoWorld");
        System.out.println(a.matches());

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aol-nnov, 2015-09-16
@rienopely

You just don't know how to use regular expressions. ... and googling
www.ocpsoft.org/opensource/guide-to-regular-expres...

X
X-, 2015-09-16
NoNAME @XNoNAME

System.out.println(a.find());
or so

Pattern pattern = Pattern.
                compile(".*a.*");
        Matcher a = pattern.matcher("HelssshaWorld");
        System.out.println(a.matches());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question