I'm sure this type of question gets posted a lot here. I have this regex:

```
^\[.*\]

```

which should match

```
[Test]Hi there

```

And according to [RegexPal](http://www.regexpal.com/), it does. However, in this Java SCCE it doesn't:

```
final String pat = "^\\[.*\\]";
final String str = "[Test]Hi there";
System.out.println(pat);
System.out.println(str);
System.out.println(str.matches(pat));

```

Output:

```
^\[.*\]
[Test]Hi there
false

```

Why doesn't it match?