Steve Steve - 1 year ago 56
Java Question

Java Regular Expressions: How to express a string that can be ANYTHING?

I've been working with an online regular expression tester to develop a Java regular expression.

What I would like is a regular expression that will match a particular pattern at the start of a strong, a particular pattern at the end of a string, and ANYTHING in between in that string.

For example it would file names structured like this


can literally be anything.

I tried this something similar to this in the regular expression tester, but it failed:


Any idea what the Java regex equivalent of a
or any string/any pattern would be?

Answer Source

It is .*. The . is "any character and the * is any number of them.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download