Is this possible?

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

franknbeans
Posts: 17
Joined: Wed Aug 30, 2006 1:26 am

Is this possible?

Postby franknbeans » Wed Aug 30, 2006 1:33 am

I am hoping I can do some sort of pattern matching with this.
I have data structured as such:

{{some tag}}date<other junk here>

I would like to have it search thousands of files (txt, asp, htm, php, etc) and when it finds {{some tag}} it counts 10 characters -past the date (the date format is 08/25/2007) then takes everything it sees after the date and removes all of it all the way to the end of the file eliminating white spaces and everything

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

Postby DataMystic Support » Wed Aug 30, 2006 8:53 am

Use the EasyPattern:

Code: Select all

[ capture( '{{some tag}}', 2 digits, '/', 2 digits, '/', 4 digits),
  longest 0+ chars   ;match up to end of file ]


Replace with

Code: Select all

$1


You will need to increase the maximum allowed match size (under the [...] button) to allow for the expected number of characters between the date and the end of file.
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

franknbeans
Posts: 17
Joined: Wed Aug 30, 2006 1:26 am

Postby franknbeans » Thu Aug 31, 2006 2:30 pm

Image

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

Postby DataMystic Support » Fri Sep 01, 2006 9:22 am

Sorry, make that:

Code: Select all

[ capture( '{{some tag}}', 2 digits, '/', 2 digits, '/', 4 digits),
  longest 0+ chars   ;match up to end of file
 ]
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

franknbeans
Posts: 17
Joined: Wed Aug 30, 2006 1:26 am

Postby franknbeans » Fri Sep 01, 2006 10:47 am

what's the difference? white spaces? carriage return? Syntax? sorry for the questions but I am trying to be more self sufficient (teach me to fish scenario here...)

Also, I tried out using some of the filters you listed in your FAQ such as remove everything from the right of a tag, remove everything to the left of a tag as well as remove everything between tags but I could not get any of them to work, no errors, just no results.

If I learned how to do these correctly, I think this program may come in very handy for me as it would help me eliminate 6 or 7 standalone tools I currently use.

Thanks!

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

Postby DataMystic Support » Fri Sep 01, 2006 1:22 pm

Sorry - the difference is the closing ']' is no longer in the comment started by ';' - which runs until the end of the line. I just added an extra new line.

Do you mean the FAQ on the website:
http://www.datamystic.com/textpipe/faq.html
We've updated this slightly to indicate a Perl pattern search/replace filter which was a bit vague.

Or was there another page we could update (website or help file)?
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

franknbeans
Posts: 17
Joined: Wed Aug 30, 2006 1:26 am

Postby franknbeans » Sat Sep 02, 2006 12:41 am

Yes, the FAQ listed at the link you provided. The filters I am referring to are these three:

How can I search and replace within <form>...</form> tags?
How can I search and replace everything after a particular character?
How can I search and replace everything before a particular character?

Especially important would be the first one. I tried these but could not get any results. Any idea what I may be doing wrong?

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

Postby DataMystic Support » Mon Sep 04, 2006 12:29 pm

We've updated this again, to:

If you want to search and replace inside <form> elements, use Filters\Restrict\HTML or XML element or attribute, and select Restrict to between tags <FORM> and </FORM>. Check 'Include start and end tags' if you also want to search/replace inside the attributes of the tag as well.

Next, add a new search and replace (Filters\Replace\Find pattern (perl style)) and drag it INSIDE the original. This new search and replace acts only on the text found by the original search and replace, i.e. all the text between the FORM tags
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

franknbeans
Posts: 17
Joined: Wed Aug 30, 2006 1:26 am

Postby franknbeans » Wed Sep 06, 2006 12:12 am

I see, is there any way to tell textpipe to remove EVERYTHING between the designated tags no matter what is already present .... or, replace EVERYTHING between the tags with <something>?

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

Postby DataMystic Support » Wed Sep 06, 2006 9:42 am

Yes, use the EasyPattern search/replace:

<form [ 0+ chars ]</form>

Replace with nothing, or with the new text.

Note: We did not use '<form>' because the <form> element can contain other attributes.
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 2 guests