Create a Simple ezParse Rule

Let’s create a rule called DoubleQuotedText for a file with the extension TXT.  This will identify text between double-quotes.  It is a very versatile rule that can be adapted to many situations.

  1. Select Options from the Tools menu and select ezParse from the list displayed on the screen.

  2. From the File Groups list control, select Text Based Files.  Select TXT from the File Extension list, then select Add from the Rules section of this dialog panel . Type DoubleQuotedText when requested to do so and then press OK.

    ezparse_simple_rule1.bmp

  3. Now that you’ve created a Rule called DoubleQuotedText, double-click it, or highlight the rule and select Edit Rule.

  4. In the resulting dialog, enter a double quote as the StartTag and the EndTag

    ezparse_simple_rule2.bmp

  1. In the Preview section, use the browse button and locate the file idbasedfiles.txt. Press the Preview button to display the contents of the file in the File Preview window.  The left hand window displays the raw file with colour coding to indicate the start tag, localizable text and end tag.  The right hand window displays the extracted text based on the rule we have just created.

note.bmp

The preview of the original file is colour coded to help debug ezParse rules. A different colour is used for each element in a matching rule so you can easily spot when rules mismatch content in your file.
 

Pink colour indicates the Start Tag
Green is the localizable text

Yellow is the EndTag

 

This file has translatable text enclosed between double-quote characters. In addition to this it has an ID at the start of each line that uniquely identifies each string. For this simple rule, we did not attempt to extract the ID.  To understand how to extract the text and the ID, see the topic Create an Advanced ezParse Rule.

 

The ezParse rule is now complete and can be used to extract text from any file with a similar format.  Press OK to close the Edit Methods dialog and OK again to save the rule on your machine.