R12 Publication-2025July16

Add Start/End Line to Narrow Down Text Range

Setting a start line, end line, or both will help to narrow down the range of lines of text to apply a Parser and get more accurate results. When no start/end line is configured in a Parser, the matching scope includes the full-text range.

Information Note: It’s not recommended to declare variables in the line pattern of a start/end line. If a variable is defined in the line pattern of a start/end line, it will be treated as a dummy variable, and its values will not be extracted.

The following example illustrates how to add start line and end line.

For example, without a start line, the paragraph Parser always parses port and vlan allowed on trunk variables by using the default top-down sequence. To narrow the scope the parsed sample text, you need to add a start line and end line.

  1. Create a new parser, then retrieve the command show interface trunk data on the device BJ-L2-coreB

  2. In the sample text, select Fa0/5 and 10, 700 in line 10, then change the variable name: Change $var1 to "port" and change $var2 to "vLAN".
      
  3. Click Define Start Line from the pattern drop-down menu, a Start Line pattern will be added. Then input 'fa0/5" as the start line. 

    Information Note: Click the setting icon  of the start line, then check/uncheck the check box in the pop-up window to decide whether the start line is included in the parsing scope. By default, the start line is included in the parsing scope. In this example, the start line is excluded. 

  4. Click Define End Line from the pattern drop-down menu, then an End Line pattern will be added. Then input '^$" as the end line so that the parsing will stop at an empty line. 
     
    Information Note: Click the setting icon  of the end line, then check/uncheck the check box in the pop-up window to decide whether the end line is included in the parsing scope. By default, the end line is not included in the parsing scope.

  5. Click Apply at the upper-right corner to confirm the pattern definitions. Then you will notice the output in the output pane changes and the parsed results are refined.