match-message

Mode: Configuration Mode

Description:

match limits the allowable inputs, it is definied using regular expressions, but it is applicable to all ddl types (not just strings).

The help message does not automatically prompt users for valid matching patterns. match-message is the mechanism to prompt users for the appropriate inputs.

Example:

        object newbie {
            help "Newbie section";

            object number-letter {
                help "Test default";
                    attribute number {
                    type int;
                    match "^[1-5]$";
                    match-message "valid number is between 1 and 5";
                    default 3;
                }
                attribute letter {
                    type string;
                    match "^[A-za-z]$";
                    match-message "letter can be any capital or small letter";
                    default "a";
                }
            }
        }

Display:

        user@router# set newbie number-letter ?
        Possible completions:
          <[Enter]>            Execute this command
          letter               Test letter with match statement
          number               Test number with match statement
          |                    Pipe through a command
        [edit]
        user@router# set newbie number-letter letter abcd 
        error: letter: 'abcd': letter can be any capital or small letter

        [edit]
        user@router# set newbie number-letter letter k       

        [edit]
        user@router# set newbie number-letter number 18 
        error: number: '18': valid number is between 1 and 5

        [edit]
        user@router# set newbie number-letter number 4

        [edit]
        user@router# show newbie
        number-letter {
            number 4;
            letter k;
        }

See also:

Reference (to programmers guide/style guide):


2007-2008 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are trademarks of Juniper Networks, Inc.
Generated on Sun May 30 20:23:12 2010 for DDL Reference Guide by doxygen 1.4.5