Replace all ' and " on a multi-line text

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

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

Replace all ' and " on a multi-line text

Postby gerd » Wed Mar 12, 2008 11:05 pm

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

Postby DataMystic Support » Thu Mar 13, 2008 8:02 am

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
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

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

Postby gerd » Fri Mar 14, 2008 3:00 am

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

Postby DataMystic Support » Fri Mar 14, 2008 7:04 am

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
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

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

Postby gerd » Fri Mar 14, 2008 8:06 pm

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

Postby DataMystic Support » Mon Mar 17, 2008 7:33 am

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
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

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

Postby gerd » Mon Mar 17, 2008 7:11 pm

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

Postby DataMystic Support » Tue Mar 18, 2008 9:56 am

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!
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

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

Postby gerd » Tue Mar 18, 2008 8:06 pm

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


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: No registered users and 2 guests