Jump to content

Remove __ amount of characters?


Recommended Posts

I have this file and I want to remove the first few characters of it:

 

$file001 = array("http://site.com/file.php?url=001");
$file002 = array("http://site.com/file.php?url=002");
$file003 = array("http://site.com/file.php?url=003");
$file004 = array("http://site.com/file.php?url=004");
$file005 = array("http://site.com/file.php?url=005");
$file006 = array("http://site.com/file.php?url=006");
$file007 = array("http://site.com/file.php?url=007");
$file008 = array("http://site.com/file.php?url=008");
$file009 = array("http://site.com/file.php?url=009");
$file0010 = array("http://site.com/file.php?url=0010");
$file0011 = array("http://site.com/file.php?url=0011");
$file0012 = array("http://site.com/file.php?url=0012");
$file0013 = array("http://site.com/file.php?url=0013");
$file0014 = array("http://site.com/file.php?url=0014");
$file0015 = array("http://site.com/file.php?url=0015");
$file0016 = array("http://site.com/file.php?url=0016");
$file0017 = array("http://site.com/file.php?url=0017");
$file0018 = array("http://site.com/file.php?url=0018");
$file0019 = array("http://site.com/file.php?url=0019");
$file0020 = array("http://site.com/file.php?url=0020");
$file0021 = array("http://site.com/file.php?url=0021");
$file0022 = array("http://site.com/file.php?url=0022");
$file0023 = array("http://site.com/file.php?url=0023");
$file0024 = array("http://site.com/file.php?url=0024");
$file0025 = array("http://site.com/file.php?url=0025");

 

So in the end I just want this left:

 

"http://site.com/file.php?url=001");
"http://site.com/file.php?url=002");
"http://site.com/file.php?url=003");
"http://site.com/file.php?url=004");
etc

 

I know Notepad++ has a "Replace" feature but it doesn't remove all of the changing numbers next to "$file"

 

Is there a PHP code or a tool that does this?

Link to comment
https://forums.phpfreaks.com/topic/183363-remove-__-amount-of-characters/
Share on other sites

Notepad++ actually supports Regular Expressions. If you press Ctrl + F then goto the replace tab you can check the box that says "Regular Expressions". Then search for: $[^"]* and replace it with nothing you'll be left with what you want.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.