Page 1 of 1

Is this possible?

Posted: Wed Aug 30, 2006 1:33 am
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

Posted: Wed Aug 30, 2006 8:53 am
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.

Posted: Thu Aug 31, 2006 2:30 pm
by franknbeans
Image

Posted: Fri Sep 01, 2006 9:22 am
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
 ]

Posted: Fri Sep 01, 2006 10:47 am
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!

Posted: Fri Sep 01, 2006 1:22 pm
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)?

Posted: Sat Sep 02, 2006 12:41 am
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?

Posted: Mon Sep 04, 2006 12:29 pm
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

Posted: Wed Sep 06, 2006 12:12 am
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>?

Posted: Wed Sep 06, 2006 9:42 am
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.