Home > Back-end >  What is a glob
What is a glob

Time:09-18

Can use the glob syntax to specify schema matching, when the syntax is glob, string similar to regular expressions but syntax is more easy to use the finite model of language to match the path expression,
Global model is specified as a string, and matching with other string directory or file name, for example), Glob syntax to follow a few simple rules:
The asterisk * with any number of characters (including no character) match,
Two asterisks * *, works like * but across the border from directory, this syntax is often used to match the full path to the,
A question mark? , matches only one character at a time,
Braces assigned subpattern collection, such as:
{} the sun, the moon, and stars match "the sun", "moon" or "stars,"
} {temp *, TMP * match begin with "temp" or "TMP" all of the string, a set of square brackets said a single character, or, if you use a hyphen (-), is a series of characters, such as:
? Aeiou match any lowercase vowels,
? [0-9] to match any number,
? [a-z] to match any capital letters,
? [a-z, a-z] to match any lowercase letters,
? In square brackets, *,? And \ with their matching,
? All other characters matching,
? To match *,? Or other special characters, you can use the backslash character escaped \, such as matching a backslash, \ \ and \? Match the question mark,
Here are some examples of glob grammar:
? * HTML - all to match. The string at the end of the HTML
? ????? - all string match exactly three letters or Numbers
? * [0-9] * - match all contain numeric string
? *.} {HTM, HTML, PDF, match with.. HTM, HTML or PDF. At the end of any string
? a? *. Java - matches any string to the beginning a, followed by at least one letter or number, in Java. At the end of the string
? [0-9] {foo * * *} - matches any string starting with foo or contain numeric values of any string
Glob syntax is powerful and easy to use, but, if not enough to meet this need, can also use regular expressions,



  • Related