Valleriani
asked on
PHP and REGEXP: Remove a specific line that has a certain javascript file in it.
Apparently when using AVG (Antivirus) it likes to add coding in WYSIWYG such as CKEDITOR. Most help has been to 'disable' AVG, but this doesn't suite me for my website. I'd prefer the coding be removed if it was there on save. I already have PHP processing after clicking save, I just don't know how to do this portion because it can be slightly random, but the javascript file seems to always be the same:
This is the line that gets added:
<script src="/A2EB891D63C8/avg_ls_ dom.js" type="text/javascript"></s cript>
The thing is, the 'A2EB891D63C8' can be random from what I see. The script is always avg_ls_dom.s, and it has a starting <script and ending </script> right after it. It's a bit above what I know of, since I only know regexp in basic terms (Like removing all but a-z0-9/etc.)
Any suggestions here? I just simply want to remove it every time in a preg_replace (I believe that's what it would use.)
Thank you very much!
This is the line that gets added:
<script src="/A2EB891D63C8/avg_ls_
The thing is, the 'A2EB891D63C8' can be random from what I see. The script is always avg_ls_dom.s, and it has a starting <script and ending </script> right after it. It's a bit above what I know of, since I only know regexp in basic terms (Like removing all but a-z0-9/etc.)
Any suggestions here? I just simply want to remove it every time in a preg_replace (I believe that's what it would use.)
Thank you very much!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It does work, but then again all of your <script> tags are on different lines I would bet (and you are not using single-line mode). If you put them on one single line, then you would see a different result.
$pattern = "#<script[^>]*avg_ls_dom.j