Useful tip for capture text filters

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

Post Reply
DFH
Posts: 788
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Useful tip for capture text filters

Post by DFH » Mon Dec 04, 2017 7:39 pm

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.

User avatar
DataMystic Support
Site Admin
Posts: 2273
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Useful tip for capture text filters

Post by DataMystic Support » Wed Jan 10, 2018 6:01 am

Thanks David! Useful tip
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests