source: PSPA/madxPSPA/doc/usrguide/Introduction/wildcard.html @ 430

Last change on this file since 430 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 2.6 KB
Line 
1<head>
2<title>Wildcards</title>
3<!-- Changed by: Chris ISELIN, 27-Mar-1997 -->
4<!-- Changed by: Hans Grote, 31-Jul-2002 -->
5</head>
6
7<body bgcolor="#ffffff">
8
9<center>
10EUROPEAN ORGANIZATION FOR NUCLEAR RESEARCH
11<IMG SRC="http://cern.ch/madx/icons/mx7_25.gif" align=right>
12<h2>Regular Expressions</h2>
13</center>
14
15Some commands allow selection of items via "regular expression" strings.
16Such a pattern string <b>must</b> be enclosed in single or double quotes.
17MAD-X follows regexp (Unix regular expression patterns) for matching.
18The following features are implemented:
19<p>
20A "search string" below is the string containing the pattern, a "target
21string" is the string being searched for a possible match with the pattern.
22<ul>
23<li>"^" at the start of the search string:
24Match following search string at the start of the target string; otherwise
25the search string can start anywhere in the target string. To search for a
26genuine "^" anywhere, use "\^".
27<li>"$" at the end of the search string:
28Match preceding search string at the end of the target string; otherwise
29the search string can end anywhere in the target string. To search for a
30genuine "$" anywhere, use "\$".
31<li>".":
32Stands for an arbitrary character; to search for a genuine ".", use "\."
33<li>"[xyz]":
34Stands for one character belonging to the string contained in brackets
35(example: "[abc]" means one of a, b, c).
36<li>"[a-ex-z]":
37Stands for ranges of characters
38(example: "[a-zA-Z]" means any letter).
39<li>"[^xyz]" (i.e. a "^" as first character in a square bracket):
40Stands for exclusion of all characters in the list, i.e. "[^a-z]"
41means "any character but a lower case letter".
42<li>"*":
43Allows zero or more repetitions of the preceding character, either specified
44directly, or from a list.
45(examples: "a*" means zero or more occurrences of "a",
46"[A-Z]*" means zero or more upper-case letters).
47<li>"backslash-c" (e.g. "\."):
48Removes the special meaning of character c.
49</ul>
50All other characters stand for themselves.
51Example:
52<pre>
53select,flag=twiss,pattern=&quot;^d..$&quot; ;
54select,flag=twiss,pattern=&quot;^k.*qd.*\.r1$&quot; ;
55</pre>
56The first command selects all elements whose names have exactly three
57characters and begin with the letter "D".
58The second command selects elements beginning with the letter "K",
59containing the string "QD", and ending with the string ".R1".
60The two occurrences of ".*" each stand for an arbitrary
61number (including zero) of any character,
62and the occurrence "\." stands for a literal period.
63<p>
64
65<address>
66<a href="http://www.cern.ch/Hans.Grote/hansg_sign.html">hansg</a>,
67May 8, 2001
68</address>
69
70</body>
Note: See TracBrowser for help on using the repository browser.