Using Sub-Filters in Search and Replace

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

scrandal
Posts: 7
Joined: Wed Jun 01, 2011 4:54 am

Using Sub-Filters in Search and Replace

Postby scrandal » Fri Jun 10, 2011 2:00 am

I'm not sure if I'm making proper use of Textpipe's search and replace subfilters...

I would like to (1) search for a line of code (2) store some the code in variables (3) IF and only IF the line of code is found THEN (4) cut and move the code to the end of the HTML document.

I've displayed my filters below, and it's the subfilter that isn't working: (the variable capture- @name and @clipboard- IS working).

I only want textpipe to perform the subfilter IF the parent filter is "TRUE". Is there a way to do that?

Note: The filters DO work if I "promote" the second one so that it's not a subfilter, BUT I need the filters to perform as an "IF/THEN" query. Only SOME of the files that I will be processing will have this line of code:
<p><b>Content Author: </b>"Author's Name"</p>.

EasyPattern [<p><b>Content [capture(1 or more characters) as 'name']:</b> [capture(1 or more characters) as 'clipboard']</p>] with []
| [ ] Match case
| [ ] Whole words only
| [ ] Case sensitive replace
| [X] Prompt on replace
| [ ] Skip prompt if identical
| [ ] First only
| [ ] Extract matches
| Maximum text buffer size 4096
|
+--Perl pattern [<!-- End Editable Area -->] with [<!-- End Editable Area -->\r\n<p><b>Content @name:</b> @clipboard</p>\r\n]
[ ] Match case
[ ] Whole words only
[ ] Case sensitive replace
[X] Prompt on replace
[ ] Skip prompt if identical
[ ] First only
[ ] Extract matches
Maximum text buffer size 4096
[ ] Maximum match (greedy)
[ ] Allow comments
[X] '.' matches newline
[ ] UTF-8 Support

Thank you very much in advance for your help! -Suzanne

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

Re: Using Sub-Filters in Search and Replace

Postby DataMystic Support » Tue Jun 14, 2011 4:53 pm

Hi Suzanne,

You need to perform these all as one search/replace that encompasses the original text location as well as its target location.

Code: Select all

<p><b>Content [capture(1 or more characters) as 'name']:</b> [capture(1 or more characters) as 'clipboard']</p>[capture(0+chars) as 'body']<!-- End Editable Area -->


replace with:

Code: Select all

<p><b>
@body<!-- End Editable Area -->\r\n<p><b>Content @name:</b> @clipboard</p>\r\n
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

scrandal
Posts: 7
Joined: Wed Jun 01, 2011 4:54 am

Re: Using Sub-Filters in Search and Replace

Postby scrandal » Thu Jun 16, 2011 4:57 am

Thank you - this works well!

Question for you: does the Easy Pattern language support if/then statements?

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

Re: Using Sub-Filters in Search and Replace

Postby DataMystic Support » Thu Jun 16, 2011 1:53 pm

No - not pattern matching language supports if/then.

But you can generally express it using the approach above, or uniquely in TextPipe, by using subfilters to restrict to say, a line range, then a column range, or a html element followed by an attribute.
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


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: No registered users and 1 guest