Useful tip for capture text filters
Posted: Mon Dec 04, 2017 7:39 pm
TextPipe Help already has some essential advice for the capture text filter.
Here's a useful tip:
Aside: Using this method means you don't need to worry about EOLs getting into the text to be captured.
Here's a useful tip:
Here's an example that I used for processing some USFM files:Send variable 1 to subfilter is an ideal way to control the input for the capture text filter.
Code: Select all
Comment...
| Insert the "origin" or "caller" references into each footnote
|
| Capture text to variables requires restrict to each line in turn
|
+--Restrict to each line in turn
|
|--Comment...
| | Capture variables
| |
| |--Restrict to lines matching [\\c ]
| | | [ ] Include line numbers
| | | [ ] Include filename
| | | [X] Match case
| | | [ ] Count matches
| | | Pattern type: 0
| | | [X] UTF8 Support
| | | [ ] Ignore empty matches
| | | Context before: 0
| | | Context after: 0
| | |
| | +--Perl pattern [^\\c (\d+)$] with []
| | | [X] Match case
| | | [ ] Whole words only
| | | [ ] Case sensitive replace
| | | [ ] Prompt on replace
| | | [ ] Skip prompt if identical
| | | [ ] First only
| | | [ ] Extract matches
| | | Maximum text buffer size 4096
| | | [X] Maximum match (greedy)
| | | [ ] Allow comments
| | | [ ] '.' matches newline
| | | [X] UTF-8 Support
| | |
| | +--Capture text to variable @chapter
| | Reset: 0
| | Break:
| |
| +--Restrict to lines matching [\\v ]
| | [ ] Include line numbers
| | [ ] Include filename
| | [X] Match case
| | [ ] Count matches
| | Pattern type: 0
| | [X] UTF8 Support
| | [ ] Ignore empty matches
| | Context before: 0
| | Context after: 0
| |
| +--Perl pattern [^\\v (\S+)\s] with []
| | [X] Match case
| | [ ] Whole words only
| | [ ] Case sensitive replace
| | [ ] Prompt on replace
| | [ ] Skip prompt if identical
| | [ ] First only
| | [ ] Extract matches
| | Maximum text buffer size 4096
| | [X] Maximum match (greedy)
| | [ ] Allow comments
| | [ ] '.' matches newline
| | [X] UTF-8 Support
| |
| +--Capture text to variable @verse
| Reset: 0
| Break:
|
+--Comment...
| Place reference between the \fr & \fk tags
|
+--Perl pattern [\x5Cfr( )\x5Cfk] with []
| [X] Match case
| [ ] Whole words only
| [ ] Case sensitive replace
| [ ] Prompt on replace
| [ ] Skip prompt if identical
| [ ] First only
| [ ] Extract matches
| Maximum text buffer size 4096
| [ ] Maximum match (greedy)
| [ ] Allow comments
| [ ] '.' matches newline
| [X] UTF-8 Support
|
+--Perl pattern [( )] with [$1@chapter:@verse\x20]
[X] Match case
[ ] Whole words only
[ ] Case sensitive replace
[ ] Prompt on replace
[ ] Skip prompt if identical
[ ] First only
[ ] Extract matches
Maximum text buffer size 4096
[ ] Maximum match (greedy)
[ ] Allow comments
[ ] '.' matches newline
[X] UTF-8 Support
[ ] Process longest strings first
[ ] Simultaneous search
[ ] Log summary only