Is this possible?

Get help with installation and running here.

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

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

Is this possible?

Post by franknbeans »

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: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

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.
franknbeans
Posts: 17
Joined: Wed Aug 30, 2006 1:26 am

Post by franknbeans »

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

Post by DataMystic Support »

Sorry, make that:

Code: Select all

[ capture( '{{some tag}}', 2 digits, '/', 2 digits, '/', 4 digits), 
  longest 0+ chars   ;match up to end of file
 ]
franknbeans
Posts: 17
Joined: Wed Aug 30, 2006 1:26 am

Post by franknbeans »

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: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

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)?
franknbeans
Posts: 17
Joined: Wed Aug 30, 2006 1:26 am

Post by franknbeans »

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: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

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
franknbeans
Posts: 17
Joined: Wed Aug 30, 2006 1:26 am

Post by franknbeans »

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: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

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.
Post Reply