cancel
Showing results for 
Search instead for 
Did you mean: 
ittech
Level 13

Difference between ? and *

Jump to solution

When using wildcards what is the difference between ? and *

(I know a question mark belongs at the end of that sentence, but I feel it would make it a little confusing )

Thanks!

0 Kudos
1 Solution

Accepted Solutions
eelsasser
Level 15

Re: Difference between ? and *

Jump to solution

The ? is one character position. the * is many character postitions.

abc?def matches abc1def, abcZdef, but not abc123def.

abc*def matches abc(anything)def.

0 Kudos
5 Replies
eelsasser
Level 15

Re: Difference between ? and *

Jump to solution

The ? is one character position. the * is many character postitions.

abc?def matches abc1def, abcZdef, but not abc123def.

abc*def matches abc(anything)def.

0 Kudos
McAfee Employee

Re: Difference between ? and *

Jump to solution

Oooh Yes

We are using globs: http://en.wikipedia.org/wiki/Glob_%28programming%29

? = Match ONE Character

* = Match multiple Characters

from our online help inside MWG 7 (similar exists for 6):

List of important special glob characters

The following table provides a list of important special characters for creating glob type wildcard expressions.

List of important special glob characters

Character

Description

?

(If not between square bracketsSmiley Happy Matches any single character

For example, ?est matches:

best

rest

test

and others

*

(If not between square bracketsSmiley Happy Matches any string, including the empty string

For example, b* matches:

b

best

binary3

and others

[...]

Matches any of the single characters included in the square brackets

? and * are normal characters between square brackets.

For example, [a5?] matches:

a

5

?

Note: The first character must not be an ! (exclamation mark).

!

Matches any single character except those following the exclamation mark

For example, [!ab] matches:

c

S

%

and others, but not:

a

b

-

Is used to denote a range of characters

For example, [a-f A-F 0-5] matches:

d

F

3

and others

/

Is not matched by ? or * and cannot be included in [...] or be part of a range

This means, for example, that http://linux.die.net/* does not match the following pathname:

http://linux.die.net/man/7/glob

The pathname is, however, matched by:

http://linux.die.net/*/*/*

\

If preceding ?, *, or [, these are normal characters

For example, [mn\*\[] matches:

m

n

*

[

.

A file name beginning with a . (dot), must be matched explicitly.

For example, the command:

rm *

will not remove the file .profile.

However, the following command will:

rm .*

Michael

0 Kudos
ittech
Level 13

Re: Difference between ? and *

Jump to solution
0 Kudos
eelsasser
Level 15

Re: Difference between ? and *

Jump to solution

That document seems to be erroneous.

If I put http://linux.die.net/* into a list called Blocked URLs and have a block rule that says:

     URL matches in list Blocked URLs

Then the URL of http://linux.die.net/man/7/glob does get blocked. This information is wrong in the documentation.

0 Kudos
ittech
Level 13

Re: Difference between ? and *

Jump to solution

Great! Feel a little better now

0 Kudos