cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Former Member
Not applicable
Report Inappropriate Content
Message 1 of 6

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!

1 Solution

Accepted Solutions
eelsasser
McAfee Retired
McAfee Retired
Report Inappropriate Content
Message 2 of 6

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.

View solution in original post

5 Replies
eelsasser
McAfee Retired
McAfee Retired
Report Inappropriate Content
Message 2 of 6

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.

View solution in original post

MSchneider
McAfee Employee
McAfee Employee
Report Inappropriate Content
Message 3 of 6

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 brackets:) Matches any single character

For example, ?est matches:

best

rest

test

and others

*

(If not between square brackets:) 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

Michael Schneider
Senior Manager of PM
for Web Protection and UCE
(•‿•)
Former Member
Not applicable
Report Inappropriate Content
Message 4 of 6

Re: Difference between ? and *

Jump to solution
eelsasser
McAfee Retired
McAfee Retired
Report Inappropriate Content
Message 5 of 6

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.

Former Member
Not applicable
Report Inappropriate Content
Message 6 of 6

Re: Difference between ? and *

Jump to solution

Great! Feel a little better now

You Deserve an Award
Don't forget, when your helpful posts earn a kudos or get accepted as a solution you can unlock perks and badges. Those aren't the only badges, either. How many can you collect? Click here to learn more.

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community