|
|
|
Forum Member
Group: Forum Members
Last Login: 3/24/2006 11:50:00 PM
Posts: 4,
Visits: 1
|
|
Hello, I have trouble to find/replace a string if the find-string goes over more than one line. For example: I have the following code: Line 1: <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> Line 2: <meta http-equiv="content-language" content="de,en,en-us"> and I want to replace both lines with a function like <? php tags() ?> Unfortunately, TopStyle does not find the lines 1 & 2 in the document if I copy and paste the first two lines into the "Text to find" box. I tried with a blank inbetween but it did not help. Is there a trick to tell the system that this is a line-break or am I missing something else? Thanks and regards, Sandra
|
|
|
|
|
Forum Deity
Group: Moderators
Last Login: 12/31/2008 11:01:02 AM
Posts: 1,278,
Visits: 1,552
|
|
For multi-line, you need to use TopStyle regular expression mode.
Open the Replace dialog and check "Regular expression" under Options. Then click the link that appears labeled "Need help with regular expressions?" to see documentation on TS' regex handling.
In the case of your particular example, the search string would be:<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"><meta http-equiv="content-language" content="de,en,en-us"> Note the "" between the two lines of text. That stands for new line and is the "glue" that brings the two bits together.
Be sure to test this on a copy of your files, first.
Place your ad here!
|
|
|
|
|
Forum Member
Group: Forum Members
Last Login: 3/24/2006 11:50:00 PM
Posts: 4,
Visits: 1
|
|
Hello Jack, thanks for your help but unfortunately it does not work for me (version 3.12). I also tried it with \r but without success. The expression is not found, no matter what I try  Regards, Sandra
|
|
|
|
|
Forum Deity
Group: Moderators
Last Login: 12/31/2008 11:01:02 AM
Posts: 1,278,
Visits: 1,552
|
|
Can you post a copy of your file here? You may need to use the .txt file extension. The forum software is a bit picky about what filetypes it will accept.
Place your ad here!
|
|
|
|
|
Forum Member
Group: Forum Members
Last Login: 3/24/2006 11:50:00 PM
Posts: 4,
Visits: 1
|
|
Hello Jack, please find attached the file with my comments. Just try to replace the first two lines with another string - it does not work for me. Thanks a lot and regards, Sandra
|
|
|
|
|
Forum Deity
Group: Moderators
Last Login: 12/31/2008 11:01:02 AM
Posts: 1,278,
Visits: 1,552
|
|
D'oh!
When you use regular expressions, some characters are meaningful to the parser. In this case,the - and " are causing problems. You need to escape these characters in the search string by preceding them with a backslash - \.
The properly formatted search string should look like this:<meta http\-equiv=\"content\-type\" content=\"text/html;charset=iso\-8859\-1\"><meta http\-equiv=\"content\-language\" content\=\"de,en,en\-us\"> Sorry for the confusion!
Place your ad here!
|
|
|
|
|
Forum Member
Group: Forum Members
Last Login: 3/24/2006 11:50:00 PM
Posts: 4,
Visits: 1
|
|
Aaaargh!!! I am a blockhead  Just the other day I worked with reg.expressions in my .htaccess file and did a lot of escaping - I just did not see the wood for the trees  !!! Surely it works now, thanks a lot, Jack! Cheers, Sandra
|
|
|
|