i been trying come best way php comment line regex. double line starts "//", example of php comment "// hello world". problem comment is not registering on rare occasions. figured regex might written wrong. here code:
\/\/.+?$ \/\/*.+?$ \/\/*.+? \/\/*[^>].+? \/\/*[^>]*.+? i tried different variations , combinations. cannot find perfect regex.
i have been trying capture following:
code_line_1 //comment_1 code_line_2 code_line_3 //comment_2 regex /\/\/(.*)/g seems job me capturing comments only.
optionally can use /(\/\/.*)/g capture slashes well.
php comments:
<?php echo 'this test'; // one-line c++ style comment ?> <h1>this <?php # echo 'simple';?> example</h1> maybe catch regex: /<\?php(.*?)\?>/gs
does work you?