0

I would want to replace obsolete html head codes with newer ones with the help of notepad++ regex.

I can't figure it out how to select multiple rows and how to find strings from the beginning of the file until the tag. Then in the next search&replace I would like to replace the text between to

Have tried the following and others with no avail:

(.*)<title>
</title>(.*)</head>

Seems to me that it would search only for strings in one line.

Thanks for helping me out!

*I am using Notepad++ V6.1.6

obeliksz
  • 468
  • 9
  • 24

3 Answers3

1

image

As said before, in the find dialog you must check the options regular expression option and matches newline if you want to achieve what you say.

Daniel San
  • 1,937
  • 3
  • 19
  • 36
  • I accepted M42's answer as he answered it before you (see the comments bellow my question), but gave to you an up vote for posting also an image and being so fast that I was thinking that you are M42 :) – obeliksz Jan 09 '13 at 12:28
1

You can also achieve the same effect without checking ". mathces new line" box by adding (?s) in front of the regular expression (that will enable DOTALL mode). Also you can use (?-s) in front of the expresssion to disable DOTALL mode while either ". mathces new line" is checked or DOTALL mode has been enabled by (?s) modifier. This can be useful when you want to enable or disable DOTALL mode inside the regex. For example the following regex will find both stream and block comments in PHP code:

(?s)/\*.*?\*/|//(?-s).*
Placido
  • 1,386
  • 1
  • 12
  • 24
0

Just check the box . matches new line in the search/replace window.

Toto
  • 89,455
  • 62
  • 89
  • 125