Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to find the above code and replace with my own code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<link href="default.css" rel="stylesheet" type="text/css" />

</head>

The regular expression I've tried is:

\<!.*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n]\<\/head\>

It works when I verified it by the online regex tool.

However, it doesn't work with either UltraEdit(Perl regex search mode)/Notepad++ (regex search mode).

I don't know if there are some simplified/ more efficient and working solutions.

Thank you.

share|improve this question
add comment

2 Answers

Use this regular expression (with Regular Expression Engine in the UltraEdit Find dialog set to Perl):

<![\s\S]*</head>

Tested with UltraEdit 16.1. But I think it will work for at least UltraEdit 14 and later.


Ref: Is it possible to match a pattern using a regular expression across a newline in UltraEdit?

share|improve this answer
add comment

grepWin can help you.

grepWin is a simple search and replace tool which can use regular expressions to do its job. This allows to do much more powerful searches and replaces.

alt text

grepWin is free and open source.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.