By default, a search matches forwards through a document. That is, when matching against ‘hello world’ the trigger first looks for occurrences of ‘hello’ and then ‘world’ after it.
However, you can also match backwards through a document. Backwards matching can be useful if:
Use the following syntax to specify the search direction:
Return to the start of the match, and iterate backwards through the document.
Example: fox jumped %precededBy% brown quick The matches against The quick brown fox jumped.
Example: Rimmel %precededBy% * * matches against welcome Mr. Rimmel.
Example: purchase order %sentence% %precededBy% %sentence% matches against This purchase order was raised by Spencer Rimmel.
This last example matches the entire sentence by first matching purchase order, then matching up to and including the end of the sentence. The search then skips to the start of the match (that is, purchase order) and matches backwards until the period at the end of the previous sentence.
(Default) Matches forwards.
Effect: If fox jumped over is matched against The fox jumped over the log, the cursor is initially before the start of the matched text. That is, the cursor is before fox. The cursor then moves to the first word (fox) and matches it. Now the cursor is over the word fox. Next, the cursor moves to the second word (jumped) and matches it, so the cursor is now over the word jumped. This process of MOVE then MATCH is repeated until a complete match is found, or not found.
Matches backwards.
Marks a position within the matched text.
Returns to a previously marked position.
Marks this position, then returns to a previously marked position. You can use this to jump around the document.
Example
This example matches The quick brown fox jumped over the lazy dog.
Briefly, the search marks and stores the current (cursor) position in the document, returns to that position later and continues to match in a different direction. In detail, the search expression carries out the following tasks:
1. It matches fox.
2. It adds marker (position 1) to fox using %mark%.
3. It matches jumped.
4. It adds marker (position 2) to jumped, and returns to previous position (position 1) using %markReturn%.
5. It iterates backwards using %backwards%.
6. It matches brown quick The backwards, returning The quick brown.
7. It returns to previous position (position 2) using %return%.
8. It iterates forwards using %forwards%.
9. It matches over the lazy dog
Copyright © 2015 CA Technologies.
All rights reserved.
|
|