Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
include_once($pathToRoot.'header.php');  
echo('</div>');

assume you have variations on the above code across hundreds of files, how do you match against the first occurrence of

</div>

after

header.php' 

?

share|improve this question

2 Answers

up vote 0 down vote accepted

In the find field: (?s)(header\.php'.+?)</div>

In the replace (if you what to replace </div> with </test>): $1</test>

share|improve this answer
Thank you the correct syntax for the s modifier was tripping me up – arcanine yesterday

I don't know that sublimetext2 but the regular expression would look like this:

/include_once\($pathToRoot.'header.php'\);(.*?)(<\/div>)/s

The first group would be the string between the include and the closing div and the second group would be the closing div itself.

share|improve this answer

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.