multi-line regex find & replace in folder

Hi,

I would like to do a multiline regex "search and replace" on a directory of HTML files in PhpStorm.

If I was to do this regex in PHP code it would look like this:

$new_content = preg_replace('#^.*<div>#imsU','<newstuff>',$old_content);

this replaces everything from the very first line of the content up to the first <div> tag with <newstuff>

is this possible in phpstorm? I notice in the documentation that \A is "beginning of content" but I cannot seem to get it working.

Any ideas?

Thanks!
Dave

2 comments

This seems to do the trick:

Find:

\A[\s\S]*(<div>)

Replace:

<newstuff>$1

0

Champion.

* bookmarks for next time *

0

Please sign in to leave a comment.