How many files does the matcher in this fragment match? PathMatcher matcher = FileSystems.getDefault ().getPathMatcher ("glob: *???_*1?

The default file system includes a logFiles directory that contains the following files:
Log-Jan 2009
log_0l_20l0
log_Feb20l0
log_Feb2011

log_10.2012
log-sum-2012
How many files does the matcher in this fragment match?
PathMatcher matcher = FileSystems.getDefault ().getPathMatcher (“glob: *???_*1?” );

The default file system includes a logFiles directory that contains the following files:
Log-Jan 2009
log_0l_20l0
log_Feb20l0
log_Feb2011

log_10.2012
log-sum-2012
How many files does the matcher in this fragment match?
PathMatcher matcher = FileSystems.getDefault ().getPathMatcher (“glob: *???_*1?” );

A.
One

B.
Two

C.
Three

D.
Four

E.
Five

F.
Six

Explanation:

The pattern to match is *???_*1? (regex “.*…_.*1.”)
This means at least three characters before the symbol _ , followed by any amount of characters.
The next tolast character must be 1. The last character can by any character.
The following file names match this pattern:
log_Feb2011
log_10.2012
Trap !! l is not 1 !!



Leave a Reply 2

Your email address will not be published. Required fields are marked *


karim Ali

karim Ali

D

Rafael

Rafael

B) Because ( | != 1)