lwc wrote:This isn't DOS.
The wildcard is actually the only part you haven't mentioned - the dot (".").
. is like the * from DOS (i.e. everything or nothing).
Well, sort of. Because in DOS * is enough and here the wildcard is accompanied by * or +, which signal how many times can something (in the case of ".", make it everything) be repeated.
* means whatever is inside (here*) can be repeated 0 or more times. So "here" would work. So would "herehere" and "herehereherehereherehere".
There's also +, which means 1 or more times (not 0). So (here+) means that "herehere" would work and so would "herehereherehere", but not just "here" alone.
In other words, there must be at least one repetition!
() just means which part can be repeated. It signals which letters you refer to. After all, without it, how would it know whether allofthis.* should be repeated or just the word "this", in which case it'd be allof(this*), get it?
So now you can understand that "(.*)" or "(.+)" means that everything can be repeated.
In the case of "list(.*)", it would work for list@ (well, only in the former case), list-bla@, list-whatever@, listing@, etc.
This all belongs to a sub-language (with the lack of a better term) called "regional expressions" (aka regexp) that is a part of all the major programming languages (Javascript, CGI, PHP, etc.).
Sorry to burst your bubble, but most of what you said is not correct. * means that the previous token should be repeated 0 or more times. In this case, that means that "here" would match, as well as "herehere", but "" would match too.
+ means 1 or more. It
would match "here", which you said it wouldn't. But it would
not match "".
And regexp is actually "regular expressions" not "regional expressions." (Yep, they exist all over the globe!)
Furthermore,
(here*) would not do what you expect. The quantifiers (*, +, {n,m}, etc) match the smallest previous token. In this case, it's like saying
(her(e*)). You would match "her", "here", and "hereeeeeeeee". If you really want 0 or more of "here", then you should do
(here)*.
I'm not trying to be nitpicky, but while these are some small errors, they can be very annoying when tracking down -- especially if you're deleting email from your boss with an incorrectly-written exclusive sender.