Parse & Insert

9 minute read Last updated on July 06, 2021

Parse & Insert

The Parse & Insert function is used to insert a keyword or phrase into a file after meeting your search criteria. You need to specify the search criteria in the upper portion of the window and then use the lower section to define where and when to insert the text string.

Note: This process can be used with any files that have been converted to PS, PCL, or PRN file types. In addition, this process works with text files.

To open the Parse And Insert Node window, add a process node for Parse & Insert and double-click on it.

Parse And Insert Node

  • Check the Enabled box so that the process will be run. When unchecked, this process will be ignored. Documents will pass through as if the node was not present (i.e., continue along the default or ‘positive’ path). Note that a disabled node will not check for logic or error conditions.

  • In the Node Name field, enter a meaningful name for the Parse & Insert node.

  • In the Description field, enter a description for the Parse & Insert node. Although this is not required, it can be helpful to distinguish multiple processes from each other. If the description is long, you can hover the mouse over the field to read its entire contents.

  • In the Search options area, do the following:

    • Check the Match case box to include in the results file names which match the case specified.

    • Check the Match whole word box to include in the results only the whole word specified.

  • In the Search mode area, specify either:

    • Normal to search the file name for the exact text entered.

    • Regular expression to use regular expressions to search for a pattern, rather than just words or phrases.

  • In the Search for area, enter the text string or expression that you want to use as your search criteria; then identify where to search. Options include:

From To
Beginning End - Search from the beginning of the file to the end of the file being parsed.
Line Number - Search from the beginning of the file to a specific line number; enter a line number in the blank field provided.
First Occurrence - Search from the beginning of the file to the first occurrence of a match. It will always return only one match.
Last Occurrence - Search from the beginning of the file to the last occurrence of a match. It will always return only one match.
Occurrence Number - Search from the beginning of the file to a specific occurrence within the results. This field can accept a negative number to search up to an occurrence that is a certain number from the last occurrence. For example, if you specify -5 in this field, you will search up to the fifth occurrence from the last. It will always return only one match.
Line Number End - Search from a specific line number (entered in the blank field provided) up to the end of the file being parsed.
Line Number - Search from a specific line number (entered in the blank field provided) to a specific line number (entered in the blank field provided).
First Occurrence - Search from a specific line number (entered in the blank field provided) to the first occurrence of a match. It will always return only one match.
Last Occurrence - Search from a specific line number (entered in the blank field provided) to the last occurrence of a match. It will always return only one match.
Occurrence Number - Search from a specific line number (entered in the blank field provided) to a specific occurrence within the results. This field can accept a negative number to search up to an occurrence that is a certain number from the last occurrence. For example, if you specify -5 in this field, you will search up to the fifth occurrence from the last. It will always return only one match.
All Previous Occurrences* First Occurrence - Search within all of the matching blocks of content within previous results up to the first occurrence of a match. It will always return only one match.
Last Occurrence - Search within all of the matching blocks of content within previous results up to the last occurrence of a match. It will always return only one match.
Occurrence Number - Search within all of the matching blocks of content within previous results up to a specific occurrence within the results. This field can accept a negative number to search for an occurrence that is a certain number from the last occurrence. For example, if you specify -5 in this field, you will search to the fifth occurrence from the last. It will always return only one match.
All Occurrences - Search within all of the matching blocks of content within previous results up to all occurrences of a match.
* The All Previous Occurrences option only works if the previous rule was a “Search for” operation and the matching results are your Start point.
  • In the Insert with area, enter the text string or expression that you want to insert; then identify where to insert the text string. Options include:
Insert at: of:
Beginning File - Insert at the beginning of file.
Line Number - Insert at the beginning of a specific line number in the file.
All Occurrences - Insert at the beginning of all occurrences of a match.
First Occurrence - Insert at the beginning of the first occurrence of a match.
Last Occurrence - Insert at the beginning of the last occurrence of a match.
Occurrence Number - Insert at the beginning of a specific occurrence within the results. This field can accept a negative number to insert at the beginning of an occurrence that is a certain number from the last occurrence. For example, if you specify -5 in this field, you will insert at the beginning of the fifth occurrence from the last.
End File - Insert at the end of file.
Line Number - Insert at the end of a specific line number in the file.
All Occurrences - Insert at the end of all occurrences of a match.
First Occurrence - Insert at the end of the first occurrence of a match.
Last Occurrence - Insert at the end of the last occurrence of a match.
Occurrence Number - Insert at the end of a specific occurrence within the results. This field can accept a negative number to specify an occurrence that is a certain number from the last occurrence. For example, if you specify -5 in this field, you will insert at the end of the fifth occurrence from the last.
Next Line Line Number - Insert at the next line after a specific line number.
All Occurrences - Insert at the next line after all occurrences of a match.
First Occurrence - Insert at the next line after the first occurrence of a match.
Last Occurrence - Insert at the next line after the last occurrence of a match.
Occurrence Number - Insert at the next line after a specific occurrence within the results. This field can accept a negative number to insert at an occurrence that is a certain number from the last occurrence. For example, if you specify -5 in this field, you will insert at the next line after the fifth occurrence from the last.
  • Select the Save button to keep the Parse & Insert definition, and add a transition to the next node. You can also select the Help button to access online help and select the Cancel button to exit the window without saving any changes.

Expand References

When you use regular expressions in your search operation, you can insert the value of a specific subgroup by using the Expand References checkbox.

To insert values from regular expression subgroups, you can use the following syntax:

(\ )

or

g< > (when referencing friendly names or subgroup number)

Examples

The examples below use the following text file as the file being processed:

%KDKBody: (Letter) on

%KDKPrintMethod: print

%KDKOutputMedia: stapler

%%Requirements: numcopies(2) staple(front) fold(none) duplex(on) collate jog(alternate)

%KDKRequirements: numcopies(2) staple(front) fold(none) duplex(longedge) collate jog(alternate) trim(off)

%KDKCovers: (Letter) none

%KDKRotation: 0

%KDKError: on (Letter)

%KDKPeSubset: 1 6

%KDKPeOutput: stapler 6

Example #1: To insert the value that was found after all occurrences of %KDK but before the colon (:), do the following:

  1. On the Parse and Insert node, click the Regular Expression radio button in the Search Mode area.

  2. Enter the following regular expression in the Search area:

    Example

  3. Enter the following in the Insert area:

    (\1)

  4. Make sure that the Expand References box is checked.

  5. If the Insert at End of All Occurrences option was chosen, the result would be as follows (with the inserted text highlighted in red):

%KDKBody: (Letter) on (Body)

%KDKPrintMethod: print (PrintMethod)

%KDKOutputMedia: stapler (OutputMedia)

%KDKRequirements: numcopies(2) staple(front) fold(none) duplex(longedge) collate jog(alternate) trim(off) (Requirements)

%KDKCovers: (Letter) none (Covers)

%KDKRotation: 0 (Rotation)

%KDKError: on (Letter) (Error)

%KDKPeSubset: 1 6 (PeSubset)

%KDKPeOutput: stapler 6 (PeOutput)

Example #2: You can also use a friendly name for your subgroup. As another example:

  1. On the Parse and Insert node, click the Regular Expression radio button in the Search Mode area.

  2. Enter the following regular expression in the Search area:

    ^%KDK(.+):(?<Value1>.+)$

    where <Value1> is the friendly name for the second subgroup. The friendly name must be enclosed in angle brackets “< >”

  3. Enter the following in the Insert area:

    \g<Value1>

  4. Make sure that the Expand References box is checked.

  5. If the Beginning of File option was chosen, the result would be as follows (with the inserted string highlighted in red):

Body %KDKBody: (Letter) on

%KDKPrintMethod: print

%KDKOutputMedia: stapler

%KDKRequirements: numcopies(2) staple(front) fold(none) duplex(longedge) collate jog(alternate) trim(off)

%KDKCovers: (Letter) none

%KDKRotation: 0

%KDKError: on (Letter)

%KDKPeSubset: 1 6

%KDKPeOutput: stapler 6

Expand Dynamic Variables

As well as expanded references, you can also choose to insert expanded dynamic variables during your Parse and Insert operation by checking the Expand Dynamic Variables box. You can also specify anything that was previously captured as metadata in the workflow, such as barcodes and OCR zones.

Example: To insert the file name and extension at the end of all occurrences of a particular string, you could add {file:fullname} in the Insert area.

Using the Tool Bar

Using the tool bar, you can do the following:

Tool Bar

  • Load Text - Loads text from another file. You will be directed to a window where you can find and select the file to be loaded. Note that the file size should not exceed 2 MB.

  • Cut - Moves text to clipboard.

  • Copy - Copies text to clipboard.

  • Paste - Pastes text from clipboard.

  • Undo - Reverses the last action performed.

  • Redo - Repeats the action that had previously been “undone.”

  • Line numbers - Displays/hides line numbers.

  • White spaces/tabs - Displays/hides white spaces and tabs.

  • Text wrap - Keeps the text in the viewable area.

  • Line ends - Displays/hides markers signifying the end of the line.

  • Custom line ends - Choose what kind of markers to use to specify line endings from now on when inputting text: Windows, Unix, or Mac.

Note: After completing the Insert operation, all of the “Search For” results are cleared.