logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

yangre - YANG regular expression processor

Authors

       Radek Krejci <rkrejci@cesnet.cz>, Michal Vasko <mvasko@cesnet.cz>
       This man page was written by David Lamparter <equinox@diac24.net>

Command Line Input

-pREGEXP, --pattern=REGEXP
              One  or  more  regular  expression  patterns  to  be  tested  against  the input string.  Supplied
              expressions are tested in the order they appear on the command line.  Testing is aborted  when  an
              expression does not match (or does match, if the -i option is used.)

       -i, --invert-match
              Reverse match condition for the previous pattern.  If the pattern matches, an error is printed and
              evaluation is aborted.

       STRING
              Target  text  input  to  match  the  regular expression(s) against.  The same text is used for all
              regular expressions.  Note that only the first argument is used by yangre, if it  contains  spaces
              or  other  shell  metacharacters they must be properly escaped.  Additional arguments are silently
              ignored.

Description

yangre  is  a  command-line  tool  to  test  and  evaluate  regular  expressions for use in YANG schemas.
       Supported regular expressions are defined by the W3C's XML-Schema standard.

       yangre can be used either with regular expressions and a target string on the command line or with  input
       from  a  file.   The latter is particularly useful to avoid dealing with proper shell escaping of regular
       expression patterns, which can be somewhat tricky.

Examples

       • Test a single pattern:
             yangre -p 'te.*xt' text_text

       • Test multiple patterns:
             yangre -p '.*pat1' -p 'pat2.*' -p 'notpat' -i pat2testpat1

       • Input from a file:
             cat > /tmp/patterns <<EOF
             .*pat1
             pat2.*
              notpat

             pat2testpat1
             EOF
             yangre -f /tmp/patterns

File Input

-fFILE, --file=FILE
              Read both patterns and target text from the specified input file.

              FILE must consist of one or more YANG regular expressions, each on their own line, followed  by  a
              blank  line  and  one  line  of target text.  No preprocessing is done on file input, there are no
              comment lines and whitespace is not stripped.  A single space character  at  the  beginning  of  a
              pattern  line  inverts  the  match condition for the pattern on that line.  Patterns must still be
              properly quoted as mandated by the YANG standard.

General Options

-h, --help
              Outputs usage help and exits.

       -v, --version
              Outputs the version number and exits.

       -V, --verbose
              Increases the verbosity level. If not specified, only errors are printed, with each appearance  it
              adds: warnings, verbose messages, debug messages (if compiled with debug information).

Name

       yangre - YANG regular expression processor

Return Values

       0      Successfulmatch
              The target text matched for all patterns.

       1      Patternmismatch
              One or more patterns did not match the target  text.   An  error  message  is  printed  to  stderr
              describing which pattern was the first not to match.

       255    Othererror
              One  or  more  patterns  could  not  be  processed  or  some  other  error occurred that precluded
              processing.

See Also

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

Synopsis

yangre [-V] -p REGEXP [-i] [-p REGEXP [-i]...] STRINGyangre [-V] -f FILE

See Also