You can set up multiple rules in a single regular expression filter configuration. These are listed in the top box of the Rules section.
To add a pattern, first type a regular expression in the Regular expression text box. This can be a simple expression: for example, if you want to replace the word 'memoQ' with an inline tag, simply type 'memoQ' in the Regular expression text box.
You can also enter more complex expressions where a simple pattern can represent several different character sequences. If you click the Pattern... link next to the text box, you get a menu of elements:
For example, the regular expression '<[^/]*?>' matches text that starts with the '<' character, followed by the shortest possible sequence of characters that does not contain the '/' character, and ends in a '>' character. In short, text that matches this pattern looks like an XML <tag>.
Tip: See the topics 'How to import documents with embedded HTML markup' and 'Regular expressions' for more hints and examples.
After you type the regular expression, choose what type of tag you want to see in the place of the text. You can choose to use an opening tag , a closing tag , or an empty tag . These correspond to the types of tags commonly used in XML markup.
If you check the Required check box, memoQ will indicate a tagging error if the corresponding tag is not copied to the target text.
In the Display text text box, you can specify what memoQ should write inside the tag. This is called a replacement rule, and you also use these in auto-translation rules. You can write any text here, but you can also use the pre-defined $0 expression: if the replacement rule is $0, the tag will contain the text that memoQ found when matching the pattern.
Note: If the regular expression contains more than one non-fixed parts, you can use $1, $2 etc. to refer to the first, second etc. non-fixed part in the replacement rule. You can choose from available options if you click the Pattern... link next to the Display text box.
After you fill in the Display text box, click Add to add the rule to the list.
To modify an existing rule, click the rule in the list, and click Change.
To remove a rule from the list, click the rule, and click Delete.
The lower part of the dialog shows how the rules work. As you fill in or edit the Rules list, the Input text box shows what parts of the original text will be matched by your patterns, and the Result box shows how memoQ will tag them. Matches and replacements are higlighted in red.
By default, the Input text and Result boxes highlight the matches from all patterns. If you want to see highlights from one rule only, click the Apply only selected rule radio button, and click a rule in the Rules list.
|