Thank you so much for the nice explanation as always irneb .
Edit, formatting makes some issues. the "[ * ]" above should be like this:"[*]"
Unfortunately , this way did not work
You're welcome.
Note that example is not specific to your OP. It was intended as an alternative to:
- ` escape the next character. Say you wanted to check if the text contains any one of these special characters. You've got the option of placing them inside [], but then what about ~ and -? Much easier is to escape them. Thus you can get "`*" (or "[ * ]") will match "*" and only "*", while "*" will match anything.
What I might have missed in my explanations is that all those items are generally used together with each other. Usually using only one of them would result in tests for only one single character long strings: all except for * matches only single characters. So "`*" and "[ * ]" would only match "*", not "*Gobledy Gook". Thus as the others have explained you combine these to get something like "`**", so the "'*" tests if the string begins with * and then the "*" matches "anything" in the rest of the string. In effect every item you place in the pattern argument is as if you say "This position needs to match this", then the next item would be anded with the previous result.
Good explanations Irné, kudos.
...
For me, the second option would be more appropriate as the square brackets are usually used to match a set of characters.
Thanks, and I'm also in full agreement with the escaped asterisk instead of the alternatives. I just indicated it to show that [] also escapes most of those special characters implicitly.