products/sources/formale Sprachen/Isabelle/Tools/jEdit/dist/doc/users-guide/globs.html |
 |
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Appendix D. Glob Patterns</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="jEdit 5.6 User's Guide"><link rel="up" href="using-jedit-part.html" title="Part I. Using jEdit"><link rel="prev" href="history.html" title="Appendix C. History Text Fields"><link rel="next" href="regexps.html" title="Appendix E. Regular Expressions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix D. Glob Patterns</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="history.html">Prev</a> </td><th width="60%" align="center">Part I. Using jEdit</th><td width="20%" align="right"> <a accesskey="n" href="regexps.html">Next</a></td></tr></table><hr></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a name="globs"></a>Appendix D. Glob Patterns</h2></div></div></div><p>jEdit uses glob patterns similar to those in the various Unix shells
to implement file name filters in the file system browser. Glob patterns
resemble regular expressions somewhat, but have a much simpler syntax. The
following character sequences have special meaning within a glob
pattern:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">?</code> matches any one character</p></li><li class="listitem"><p><code class="literal">*</code> matches any number of characters</p></li><li class="listitem"><p><code class="literal">{!<em class="replaceable"><code>glob</code></em>}</code> Matches
anything that does <span class="emphasis"><em>not</em></span> match
<em class="replaceable"><code>glob</code></em></p></li><li class="listitem"><p><code class="literal">{<em class="replaceable"><code>a</code></em>,<em class="replaceable"><code>b</code></em>,<em class="replaceable"><code>c</code></em>}</code>
matches any one of <em class="replaceable"><code>a</code></em>,
<em class="replaceable"><code>b</code></em> or <em class="replaceable"><code>c</code></em></p></li><li class="listitem"><p><code class="literal">[<em class="replaceable"><code>abc</code></em>]</code> matches
any character in the set <em class="replaceable"><code>a</code></em>,
<em class="replaceable"><code>b</code></em> or <em class="replaceable"><code>c</code></em></p></li><li class="listitem"><p><code class="literal">[^<em class="replaceable"><code>abc</code></em>]</code> matches
any character not in the set <em class="replaceable"><code>a</code></em>,
<em class="replaceable"><code>b</code></em> or <em class="replaceable"><code>c</code></em></p></li><li class="listitem"><p><code class="literal">[<em class="replaceable"><code>a-z</code></em>]</code> matches
any character in the range <em class="replaceable"><code>a</code></em> to
<em class="replaceable"><code>z</code></em>, inclusive. A leading or trailing dash
will be interpreted literally</p></li></ul></div><p>Since we use <code class="literal">java.util.regex</code> patterns to implement
globs, this means that in addition to the above, a number of
<span class="quote">“<span class="quote">character class metacharacters</span>”</span> may be used. Keep in mind,
their usefulness is limited since the regex quantifier metacharacters
(asterisk, questionmark, and curly brackets) are redefined to mean something
else in filename glob language, and the regex quantifiers are not available
in glob language.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">\w</code> matches any alphanumeric character or
underscore</p></li><li class="listitem"><p><code class="literal">\s</code> matches a space or horizontal tab</p></li><li class="listitem"><p><code class="literal">\S</code> matches a printable
non-whitespace.</p></li><li class="listitem"><p><code class="literal">\d</code> matches a decimal digit</p></li></ul></div><p>Here are some examples of glob patterns:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><strong class="userinput"><code>*</code></strong> - all files.</p></li><li class="listitem"><p><strong class="userinput"><code>*.java</code></strong> - all files whose names end with
<span class="quote">“<span class="quote">.java</span>”</span>.</p></li><li class="listitem"><p><strong class="userinput"><code>*.[ch]</code></strong> - all files whose names end with
either <span class="quote">“<span class="quote">.c</span>”</span> or <span class="quote">“<span class="quote">.h</span>”</span>.</p></li><li class="listitem"><p><strong class="userinput"><code>*.{c,cpp,h,hpp,cxx,hxx}</code></strong> - all C or C++
files.</p></li><li class="listitem"><p><strong class="userinput"><code>[^#]*</code></strong> - all files whose names do not
start with <span class="quote">“<span class="quote">#</span>”</span>.</p></li></ul></div><h2><a name="d0e8054"></a>Using regexes instead of globs</h2><p>Sometimes it is desirable to use a regular expression instead of a
glob for specifying file sets. This is because regular expressions are more
powerful than globs and can provide the user with more specific filename
matching criteria. To avoid the glob-to-regex transformation, prefix your
pattern with the string <code class="literal">(re)</code>, which will tell jEdit to
not translate the following pattern into a regex (since it already is one).
For example:</p><div class="glosslist"><dl><dt><span class="glossterm"><code class="literal"> (re).*\.(h|c(c|pp)?) </code></span></dt><dd class="glossdef"><p>Matches *.c, *.cpp, *.h, *.cc</p></dd></dl></div><p>If you need to match files that begin with the glob-translate-disable
prefix <code class="literal">(re)</code>, you can escape it with a leading backslash
and the metacharacters will be translated into globs as before.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="history.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="using-jedit-part.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="regexps.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix C. History Text Fields </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix E. Regular Expressions</td></tr></table></div></body></html>
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
|
Haftungshinweis
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.
|