-2

I want to remove this line from 1000 files. http://txt.do/52h7n

How to write a regular expression to do this? Can anyone help?

closed as unclear what you're asking by Ƭᴇcʜιᴇ007, DavidPostill, duDE, Steven, Dave Feb 25 '16 at 15:40

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    what did you try and what line you want to remove? – Ali786 Feb 22 '16 at 15:37
  • 1
    Have you been hacked? You should wipe your website and restore from backup. – DavidPostill Feb 22 '16 at 15:38
  • You are not looking for regular expressions because you lirerally know whot to remove from the files. You need any kind of loop that can iterate through your files and any script-like solution that can substitute a given string with an empty string. Basically, yes, all this can be done in NP++ if you can write scripts in it, but I guess you would not ask if you could. – Gombai Sándor Feb 22 '16 at 16:01
  • Hi,, I have in first line (1000 files) this <?php $ctbobo = [...................] ?><?php Can I remove $ctbobo = [...................] ?><?php and leave first <?php ?? – John Feb 22 '16 at 16:15
  • Sorry, I thought you were to replace the text of the link itself and I did not click on it. Nevertheless, my hint is almost the same. If you already have a looping solution to iterate the files, then the rest will be easy with, just for example, awk for windows. If you insist on notepad, it will be just more difficult. – Gombai Sándor Feb 22 '16 at 16:32
1

If I understand correctly, you need to remove everything between <?php and ?> without removing the PHP tags themselves?

Assuming the text is exactly the same in all files, you can use the following regular expression:

<\?php \$ctbobo.*\$wwhipui-1;

And then replace it with <?php (note the space at the end).

The result should be something like:

<?php ?>

To do a batch search and replace in Notepad++ you need to press Search in menu, then Find in files or simply press Ctrl+Shift+F. After than you will need to select the folder that contains your files, filters (most likely you need "*.php"), insert regular expression from this post and then press Find them all. When it's done, you need to go to Replace tab in the same search dialog, insert replacing pattern from above and press Replace all.

I advise you to make a backup copy of all your files before making any batch updates.

  • 1
    Funny, I've written a couple of answers on the replace function of NP++ recently for which I started and checked the editor after a long while. And I could not recognize that Find in File tab although it's there and is really promising as the same function of the BIG IDE's. Lesson learnt. Thanks, glad I've been here. – Gombai Sándor Feb 22 '16 at 19:10

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