1
2YANGRE(1)                   General Commands Manual                  YANGRE(1)
3
4
5

NAME

7       yangre - YANG regular expression processor
8

SYNOPSIS

10       yangre [-V] -p REGEXP [-i] [-p REGEXP [-i]...] STRING
11       yangre [-V] -f FILE
12

DESCRIPTION

14       yangre  is a command-line tool to test and evaluate regular expressions
15       for use in YANG schemas.  Supported regular expressions are defined  by
16       the W3C's XML-Schema standard.
17
18       yangre  can be used either with regular expressions and a target string
19       on the command line or with input from a file.  The latter is  particu‐
20       larly  useful  to  avoid  dealing with proper shell escaping of regular
21       expression patterns, which can be somewhat tricky.
22

GENERAL OPTIONS

24       -h, --help
25              Outputs usage help and exits.
26
27       -v, --version
28              Outputs the version number and exits.
29
30       -V, --verbose
31              Increases the verbosity level. If not specified, only errors are
32              printed,  with  each  appearance it adds: warnings, verbose mes‐
33              sages, debug messages (if compiled with debug information).
34

COMMAND LINE INPUT

36       -p REGEXP, --pattern=REGEXP
37              One or more regular expression patterns to be tested against the
38              input string.  Supplied expressions are tested in the order they
39              appear on the command line.  Testing is aborted when an  expres‐
40              sion does not match (or does match, if the -i option is used.)
41
42       -i, --invert-match
43              Reverse  match  condition for the previous pattern.  If the pat‐
44              tern matches, an error is printed and evaluation is aborted.
45
46       STRING
47              Target text input to match the  regular  expression(s)  against.
48              The  same  text  is used for all regular expressions.  Note that
49              only the first argument is used by yangre, if it contains spaces
50              or  other  shell  metacharacters  they must be properly escaped.
51              Additional arguments are silently ignored.
52

FILE INPUT

54       -f FILE, --file=FILE
55              Read both patterns and target  text  from  the  specified  input
56              file.
57
58              FILE  must consist of one or more YANG regular expressions, each
59              on their own line, followed by a blank line and one line of tar‐
60              get  text.  No preprocessing is done on file input, there are no
61              comment lines and whitespace is not stripped.   A  single  space
62              character  at  the beginning of a pattern line inverts the match
63              condition for the pattern on that line.  Patterns must still  be
64              properly quoted as mandated by the YANG standard.
65

RETURN VALUES

67       0      Successful match
68              The target text matched for all patterns.
69
70       1      Pattern mismatch
71              One  or  more  patterns did not match the target text.  An error
72              message is printed to stderr describing which  pattern  was  the
73              first not to match.
74
75       255    Other error
76              One  or more patterns could not be processed or some other error
77              occurred that precluded processing.
78

EXAMPLES

80       · Test a single pattern:
81             yangre -p 'te.*xt' text_text
82
83       · Test multiple patterns:
84             yangre -p '.*pat1' -p 'pat2.*' -p 'notpat' -i pat2testpat1
85
86       · Input from a file:
87             cat > /tmp/patterns <<EOF
88             .*pat1
89             pat2.*
90              notpat
91
92             pat2testpat1
93             EOF
94             yangre -f /tmp/patterns
95
96

SEE ALSO

98       https://github.com/CESNET/libyang (libyang homepage and Git repository)
99

AUTHORS

101       Radek Krejci <rkrejci@cesnet.cz>, Michal Vasko <mvasko@cesnet.cz>
102       This man page was written by David Lamparter <equinox@diac24.net>
103
105       Copyright © 2015-2018 CESNET, a.l.e.
106
107
108
109libyang                           2018-11-09                         YANGRE(1)
Impressum