Useful tip for capture text filters

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
dfhtextpipe
Posts: 988
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Useful tip for capture text filters

Post by dfhtextpipe »

TextPipe Help already has some essential advice for the capture text filter.

Here's a useful tip:
Send variable 1 to subfilter is an ideal way to control the input for the capture text filter.
Here's an example that I used for processing some USFM files:

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
Aside: Using this method means you don't need to worry about EOLs getting into the text to be captured.
David
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Useful tip for capture text filters

Post by DataMystic Support »

Thanks David! Useful tip
Post Reply