Examples - Structuring text files (regular expression delimited text files)
Examples of using regular expressions to define text files that are delimited by regular expression patterns.
Example: Simple file name specification
The regular expression [ a-z].*[0-9]\.txt describes any name that starts with a lower case letter and ends with a digit followed by the letters *.txt
Example: Structure in a Regular Expression Delimited text file
| Text to be translated | Example settings |
|---|---|
| Starts with // and ends at the end of line | Opening pattern: Closing pattern: Clear Multiline Note that you need to provide a closing pattern (even though Multiline is clear) |
| Starts with /*, and ends with */, which can be the same or another line | Opening pattern: Closing pattern: Select Multiline |
Example: Regular Expression Delimited text file - standalone (placeholder) tag
To treat all email addresses as standalone (placeholder) tags. An example email address is:John.brown_27@gmail.co.uk
One possible expression for an email address is:
word characters, hyphens and periods, @ character, word characters, hyphens and periods
A simple corresponding regular expression is:
[\w\-\.]+@[\w\-\.]+
To use this expression to specify a standalone tag, go to and select Add Rule.
Complete the Add inline rule dialog as follows:
| Box | Example settings |
|---|---|
| Rule type | Select Placeholder |
| Rule | Opening: |
| Properties | Click Advanced. Select include with text in Placeholder behavior. |
When the file is opened for translation, any email address in the file is treated as a standalone tag and is displayed in the translation window.
Example: Regular Expression Delimited text file - tag pair
<b> and </b> to be treated as a tag pair that shows bold text. In the dialog box, select Add Rule. In the Add inline rule dialog box, complete the following:
| Box | Example settings |
|---|---|
| Rule type | Select Tag Pair |
| Rule | Opening: Closing: |
| Properties | Click Translate and select always translatable. Edit the formatting to style bold and select activate. |
When the file is opened for translation, any occurrence of <b>...</b> in the file is treated as a tag pair, and the text inside the tags is displayed in bold.