Replace all ' and " on a multi-line text

Get help with installation and running here.

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

Post Reply
gerd
Posts: 39
Joined: Wed Mar 12, 2008 10:52 pm

Replace all ' and " on a multi-line text

Post by gerd »

I have just a small trial and error knowledge of regex patterns. My Problem: I want to eliminate the two characters (' ") with no replacement from a multi-line text. The multi-line text starts with
showTooltip(event,'
and ends with
');return false

All ' and " cause the tooltips to fail.
I have tried something with * in pattern style but my knowledge ist to small.
My settings are:
Find type: (Pattern (perl) and Action: Replace
So I am looking for help what to put in
textbox "Find Pattern (perl-style)"
and in textbox "Replace with"
I am not asking for a one-step-solution. I think it is easier to do the elimination in two steps.
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 »

Set your first pattern to find perl pattern:

Code: Select all

showTooltip(event,'.*');return false
Replace with

Code: Select all

$0
Add a new search/replace and drag it inside the first one. Set it's perl pattern to:

Code: Select all

['"]
Replace with nothing
gerd
Posts: 39
Joined: Wed Mar 12, 2008 10:52 pm

Post by gerd »

Simon,
Thanks for your prompt advice.
I still have the problem that all ' and " characters are replaced and not only such characters WITHIN the above specified part of the entire text.
I have illustrated the problem with two screenshots of the settings in Textpipe and have added some explanatory text. Would you please have a look at it. Maybe this is more specific.
http://quiz-center.de/tp.htm
thanks gerd
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

You need to drag the second search replace INSIDE the first one (in the tree view) as a subfilter. Please see the Tutorials in the Help menu
gerd
Posts: 39
Joined: Wed Mar 12, 2008 10:52 pm

Post by gerd »

Simon,
I consulted the tutorials again but I am still struggling with the problem.
I have added a new screenshot which illustrates what I did.
http://quiz-center.de/tp.htm

I still get as an output that all of ' and " are replaced or none. Is there a chance to get a filter (.fll) by mail for it or may I call Australian support for it? Almost all my complicated Search & replace requests refer to subfilters which define a specific part of text in files to be searched and replaced. That is why I am very keen to know how it works.
thanks gerd
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

Ok, the problem here is that it's only the text within the single quotes that needs to be subfiltered.

Change the pattern to:

Code: Select all

showTooltip(event,'(.*)');return false
and set the Action field to 'Send variable 1 to subfilter'.

This will prevent the initial and final single quote from being included. Turn on 'Prompt On Replace' to see it working
gerd
Posts: 39
Joined: Wed Mar 12, 2008 10:52 pm

Post by gerd »

It does not work neither this way or any other way.
I will probably give it up. I added the new screenshots and the example file
example text file
to demonstrate that it does not work this way. Thus, I have to do it manually or to consult a php or perl expert to do this in perl or php. This brings me to the question:

Replace given keywords from csv file into clickable URLs

which I will put into a new thread because I think this might interest quite a few people.
gerd
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

Ahh - I see the problem. The top replace filter should be

Code: Select all

showTooltip\(event,'(.*)'\);return false
because the ( and ) are special characters.

It works perfectly for me now!
gerd
Posts: 39
Joined: Wed Mar 12, 2008 10:52 pm

Post by gerd »

Simon,
and now it works perfectly for me as well. We made it.
Thanks for the support.
gerd
Post Reply