Find a tag pair and enclose between more material...?
Posted: Tue Mar 17, 2009 5:54 am
This is certainly not possible for me to do at the moment, because TextPipe doesn't have a filter selection / creation interface or relevant 'help' text that I can really understand (and yes, I do have a science degree, for whatever good that did me! ). Thus I simply can't tell whether I'm wanting the impossible from TextPipe, but I feel that the task that I want to give to it ought to be relatively straightforward, if only I knew how to set it up.
I want to find in a search of all web pages of mine the tag pair <div id="mainTextPanel".*>, ONLY where there is a <br> tag immediately before and after that pair, and then insert material between the tag pair and the <br> tags before and after. In practice I'd be putting a further container div (with some contents) around the found tag pair.
It appears that the available filters for finding tag pairs are concerned with restricting an operation to within or between the particular tags, rather than looking at what is immediately outside them and putting stuff there.
I don't see how I can do this task safely by a straightforward search/replace, because the contents of the sought for div can itself contain <div> tags, and so it would not be possible by that means to identify the correct </div> - i.e. by using <div id="mainTextPanel".*>.*</div> as a search string. Most of the contained </div> tags would be followed by <p> tags rather than <br>, but I can't be sure of that always being the case.
Another constraint, too, could be the amount of text in the mainTextPanel div (i.e. between the tag pair), for it could theoretically be 100K or more (though normally would be much less), and I'm not sure how that would go down with its inclusion in a (.*) to then appear as $n in replace text.
Any ideas as to whether this task is easily feasible with TextPipe, and any simple tip for setting it up? Many thanks!
I want to find in a search of all web pages of mine the tag pair <div id="mainTextPanel".*>, ONLY where there is a <br> tag immediately before and after that pair, and then insert material between the tag pair and the <br> tags before and after. In practice I'd be putting a further container div (with some contents) around the found tag pair.
It appears that the available filters for finding tag pairs are concerned with restricting an operation to within or between the particular tags, rather than looking at what is immediately outside them and putting stuff there.
I don't see how I can do this task safely by a straightforward search/replace, because the contents of the sought for div can itself contain <div> tags, and so it would not be possible by that means to identify the correct </div> - i.e. by using <div id="mainTextPanel".*>.*</div> as a search string. Most of the contained </div> tags would be followed by <p> tags rather than <br>, but I can't be sure of that always being the case.
Another constraint, too, could be the amount of text in the mainTextPanel div (i.e. between the tag pair), for it could theoretically be 100K or more (though normally would be much less), and I'm not sure how that would go down with its inclusion in a (.*) to then appear as $n in replace text.
Any ideas as to whether this task is easily feasible with TextPipe, and any simple tip for setting it up? Many thanks!