Skip to content
Snippets Groups Projects
Commit b5e45b36 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Clarified usage of dot in regexp

parent da3dfd82
No related branches found
No related tags found
No related merge requests found
t1: TORSION ATOMS=5,7,9,15 t1: TORSION ATOMS=5,7,9,15
t2: TORSION ATOMS=7,9,15,17 t2: TORSION ATOMS=7,9,15,17
d1: DISTANCE ATOMS=7,17 COMPONENTS d1: DISTANCE ATOMS=7,17 COMPONENTS
PRINT ARG=(d1.[xy]),(pino) STRIDE=100 FILE=colvar FMT=%8.4f d1ox: TORSION ATOMS=7,9,15,17
#PRINT ARG=(d1.[xy]),(t[0-9]) STRIDE=100 FILE=colvar FMT=%8.4f PRINT ARG=(d1\.[xy]),(pino) STRIDE=100 FILE=colvar FMT=%8.4f
#PRINT ARG=(d1.[xy]|t[0-9]) STRIDE=100 FILE=colvar FMT=%8.4f PRINT ARG=(d1\.[xy]),(t[0-9]) STRIDE=100 FILE=colvar1 FMT=%8.4f
#PRINT ARG=(d1.[xy]),(d1.[xy]) STRIDE=100 FILE=colvar FMT=%8.4f PRINT ARG=(d1\.[xy]|t[0-9]) STRIDE=100 FILE=colvar2 FMT=%8.4f
#PRINT ARG=d1.x,d1.y STRIDE=100 FILE=colvar FMT=%8.4f PRINT ARG=(d1\.[xy]),(d1.[xy]) STRIDE=100 FILE=colvar3 FMT=%8.4f
PRINT ARG=(d1.[xy]) STRIDE=100 FILE=colvar4 FMT=%8.4f
...@@ -14,10 +14,22 @@ name have no spaces indeed, so why using them?). ...@@ -14,10 +14,22 @@ name have no spaces indeed, so why using them?).
As an example As an example
\verbatim \verbatim
d1: DISTANCE ATOMS=1,2 COMPONENTS d1: DISTANCE ATOMS=1,2 COMPONENTS
PRINT ARG=(d1.[xy]) STRIDE=100 FILE=colvar FMT=%8.4f PRINT ARG=(d1\.[xy]) STRIDE=100 FILE=colvar FMT=%8.4f
\endverbatim \endverbatim
selects for printout both d1.x and d1.y components which are generated through distance in the order they are created by plumed. selects for printout both d1.x and d1.y components which are generated through distance in the order they are created by plumed.
Notice that the "." character should be escaped if one wants to interpret it as a literal ".". Unescaped dots will match any character,
according to regular expression syntax. E.g.
\verbatim
d1: DISTANCE ATOMS=1,2 COMPONENTS
dxy: DISTANCE ATOMS=1,3
# this will match d1.x,d1.y,dxy
PRINT ARG=(d1.[xy]) STRIDE=100 FILE=colvar FMT=%8.4f
# this will match d1.x,d1.y only
PRINT ARG=(d1\.[xy]) STRIDE=100 FILE=colvar FMT=%8.4f
\endverbatim
You can also include more by using comma separated regular expressions You can also include more by using comma separated regular expressions
...@@ -25,7 +37,7 @@ You can also include more by using comma separated regular expressions ...@@ -25,7 +37,7 @@ You can also include more by using comma separated regular expressions
t1: TORSION ATOMS=5,7,9,15 t1: TORSION ATOMS=5,7,9,15
t2: TORSION ATOMS=7,9,15,17 t2: TORSION ATOMS=7,9,15,17
d1: DISTANCE ATOMS=7,17 COMPONENTS d1: DISTANCE ATOMS=7,17 COMPONENTS
PRINT ARG=(d1.[xy]),(t[0-9]) STRIDE=100 FILE=colvar FMT=%8.4f PRINT ARG=(d1\.[xy]),(t[0-9]) STRIDE=100 FILE=colvar FMT=%8.4f
\endverbatim \endverbatim
(this selects t1,t2,d1.x and d2.x) Beware if you have overlapping selection they will be duplicated. (this selects t1,t2,d1.x and d2.x) Beware if you have overlapping selection they will be duplicated.
...@@ -36,7 +48,7 @@ You can equivalently use (recommended) regexp themself with the "or" operator. ...@@ -36,7 +48,7 @@ You can equivalently use (recommended) regexp themself with the "or" operator.
t1: TORSION ATOMS=5,7,9,15 t1: TORSION ATOMS=5,7,9,15
t2: TORSION ATOMS=7,9,15,17 t2: TORSION ATOMS=7,9,15,17
d1: DISTANCE ATOMS=7,17 COMPONENTS d1: DISTANCE ATOMS=7,17 COMPONENTS
PRINT ARG=(d1.[xy]|t[0-9]) STRIDE=100 FILE=colvar FMT=%8.4f PRINT ARG=(d1\.[xy]|t[0-9]) STRIDE=100 FILE=colvar FMT=%8.4f
\endverbatim \endverbatim
that selects the same arguments. that selects the same arguments.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment