Search for top of file?

General questions about using WildEdit

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
Mike Olds
Posts: 226
Joined: Wed Sep 30, 2009 3:27 pm
Contact:

Search for top of file?

Post by Mike Olds »

Hello,

I am having a strange problem with WE.

I am looking to replace:

<html>
<head>

Which begins the files to be corrected, and to replace with:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" type="text/css" href="../../admin/styles/common.css" />
<title></title>
</head>

<body>

<div class="ctr">
<center>
<table cellspacing="0" cellpadding="6" width="80%">
<tr>
<td>

I am able to do this in a test file, but when it comes to the actual files I get no files matching.

I suspect some sort of quirk with regard to coding or some such, but I would only really like a solution. Is there a way for me to insert this doctype information at the start of the first line on a file, without reference to anything but the beginning of the first line to search for?

Search: ^ ?
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Re: Search for top of file?

Post by ben_josephs »

Your problem may be due to differences in the line endings (not the encoding). Have you experimented with the setting of
Options | Literal line break characters?
Mike Olds wrote:Is there a way for me to insert this doctype information at the start of the first line on a file
Try searching for
\A
(with Regular expression selected), which is supposed to match the beginning of the file only. Experiment with this: there are bugs in its implementation, and it doesn't always behave as expected.
User avatar
Mike Olds
Posts: 226
Joined: Wed Sep 30, 2009 3:27 pm
Contact:

Post by Mike Olds »

Hello Ben,

Thanks for the hint. It was 'linefeed only' the unix option. Bing! All done.
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
User avatar
Mike Olds
Posts: 226
Joined: Wed Sep 30, 2009 3:27 pm
Contact:

end ?

Post by Mike Olds »

OK, so now how do I find the end of the file?

I tried *^^

and fiddled again with the line endings, but no go.
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

\z matches at the end of the file.
\Z is supposed to match an optional sequence of newlines (not carriage returns) at the end of the file, but it doesn't work correctly.
User avatar
helios
Posts: 710
Joined: Sun Mar 02, 2003 5:52 pm
Location: Helios Software Solutions
Contact:

Post by helios »

The implementation of "\Z" is buggy, so "\n*\z" should be used instead.
Helios Software Solutions
User avatar
Mike Olds
Posts: 226
Joined: Wed Sep 30, 2009 3:27 pm
Contact:

Post by Mike Olds »

Thanks all.
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
Post Reply