Regular expressions allows selection of all atoms with a name starting with C as:
or segment names containing a number as
As expected, multiple terms can still be provided on the list of matching keywords, as in
resname "A.*" GLY ".*T"
to select residues starting with an A, the glycine residues, and residues ending with a T. Kind of silly, but it is just to demonstrate. As with a string, a regular expression in a numeric context gets converted to an integer, which will always be zero.
In brief, a regular selection allows matching to multiple possibilities, instead of just one character. Table 5.8 shows some of the methods that can be used.
So there are many ways to do some selections. For example, choosing atoms with a name of either CA or CB can be done in the following ways:
name CA CB name "CA|CB" name "C[AB]" name "C(A|B)"
Several caveats for those who already understand regular expressions.
VMD automatically prepends ``
^('' and appends
)$'' to the selection string. This makes the selection O match only O and not OG or PRO. On the other
$ into the command won't really
affect anything, selections that match on a substring must be
preceded and followed by ``.*'', as in
.*O.*, and some illegal
selections could be accepted as correct, but strange, as in
, which gets converted to
and matches anything starting with a C or ending with an O.
A regular expression is similar to wildcard matching in X-PLOR. Table 5.9 is a list of conversions from X-PLOR style wildcards to the matching regular expression.