About Question enthuware.ocpjp.v7.2.1628 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ewebxml
Posts: 77
Joined: Sun Jun 30, 2013 10:04 pm
Contact:

About Question enthuware.ocpjp.v7.2.1628 :

Post by ewebxml »

Question: Why does this glob pattern

glob:?{pdf, rtf}


match only those file names that have exactly four characters ?

_________________________


I understand that ? matches exactly one character in a glob pattern.

Explanation says:
?{pdf,rtf} will match only those file names that have exactly four characters and
the last three characters have to be pdf or rtf.

Question: Is this simple addition as in

[ (? = 1 ) + (rtf = 3 )] = 4

Please confirm.

admin
Site Admin
Posts: 10386
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1628 :

Post by admin »

Yes, that is correct. You may go through the details here: https://docs.oracle.com/javase/tutorial ... .html#glob

insider
Posts: 29
Joined: Wed Apr 17, 2013 9:22 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1628 :

Post by insider »

The explanation silently switches from glob syntax to Pattern/Matcher that always uses regex syntax (as far as I remember).

I suggest:
either leave current Pattern example and point out explicitly that it uses regex syntax as opposed to glob (pro: it's easier to get Pattern running for a small example than PathMatcher)
or get rid of the example and illustrate ".?pdf" regex syntax with "regex:" prefix (pro: one more opportunity to remind that there are two acceptable syntaxes for a PathMatcher)
or have both.

That's a question of explanation and is up to you, of course. Point being I didn't quite like silent transition from glob to regex syntax since they differ a lot.

admin
Site Admin
Posts: 10386
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1628 :

Post by admin »

Enhanced the explanation.
thank you for your feedback!
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests