I’m looking for a reg expression which has the exact same meaning as the “*” operator in a linux / windows command line. For example, find all files that: starts with 0 or more random chars, contains “abc” in the middle, and ends with 0 or more random chars.
So something like this in Java:
if (test.match("*abc*"))
System.out.println("found match");
Original answer:
Is the regexp which solves your problem. Note that if you want to match newline as part of your test string, you might need to enable single-line mode.
Revised answer if you are really talking about files:
is a better answer since globs do not actually match directories in “*”. For example, /etc/*bar will match /etc/foobar but will not match /etc/foo/bar. However, you said you were not interested in filenames, so the difference may be irrelevant to you.