?* regular expression in sh

Hi,
what ?* means in sh script?
I know that ? is equivalent to at least one appearance of a preceding expression and * is equivalent to at least one appearance of preceding expression but I have difficulties with a way in which I should interpret following pattern:

-?*

I would expect that it should match expressions like -, --, --- because I read it as follows:

-? means that regexp should match at least one -. Then, if there are no minuses in the expression it doesn't match. But with at least one minus * will cause that expressions which have two or more minuses will match, too.

But I have tested it and I can see that it matches any string of characters.

What is a reason?

Thanks in advance for responses.

The ? and * which you are talking about are not regex metacharacters (not in your case) but shell glob metacharacters.

=====

Glob:

? - Any one character
* - 0 or more of any character

These are not dependent upon the previous character...

=====

Regex:

? - 0 or 1 occurrence of previous character (or regex)
* - 0 or more occurrences of previous character (or regex)

Thanks,
I have just awared one minute before your post that above expressions are treated as shell metacharacters (after all I use it routinely to specify all files).

But what is a reason for which (as I have checked)

-

match in above string of metacharacters?

When you say it's matching any string of characters, can you give an example of how you're using the pattern to match?

If they are being used as shell metacharacters, it should probably match a '-' followed by at least one other character (any character will do), and then any characters after that if they exist. Basically it should match a two or more character string that starts with '-'.

It should not match a one character string, even if it's just a '-'.

Sorry,
it was my mistake. My above statement was based on the script in which such construction occured, but a match is done not by that expression, but is based on a later comparison with $#.