Home » Php » regex – Notepad++ function list PHP not working if I didn't close the PHP tag

regex – Notepad++ function list PHP not working if I didn't close the PHP tag

Posted by: admin July 12, 2020 Leave a comment


I want to use function list feature from notepad++ for my PHP code
Actually the function list is working normally if I write the close PHP tag ( ?> ).. But if I didn’t close the PHP tag, the function list is not working

I just want, the function list is still working even I didn’t close the PHP tag

See the image
On the top is without close PHP tag
On the bottom is with close PHP tag

enter image description here

Then I read this, notepad++ function list doc

I guess, I need to edit the regex.. But the problem is I can’t edit the regex because the regex looks like too complex for me

This is the regex and xml of PHP function list

<parser id="php_function" displayName="PHP" commentExpr="((/\*.*?\*)/|(//.*?$))">
    mainExpr="^[\s]*(class|abstract[\s]+class|final[\s]+class)[\t ]+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*([\s]*|[\s]*(extends|implements|(extends[\s]+(\|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+[\s]+implements))[\s]+(\,[\s]*|(\|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))+[\s]*)?\{"
    openSymbole = "\{"
    closeSymbole = "\}"
        <nameExpr expr="(class|abstract[\s]+class|final[\s]+class)[\s]+[\w]+"/>
        <nameExpr expr="[\s]+[\w]+\Z"/>
        <nameExpr expr="[\w]+\Z"/>
            <funcNameExpr expr="(?!(if|while|for|switch))[\w_]+[\s]*\([^\{]*"/>
            <!-- comment below node if want display method with parmas -->
            <funcNameExpr expr="(?!(if|while|for|switch))[\w_]+"/>

        <nameExpr expr="(?!(if|while|for))[\w_]+[\s]*\("/>
        <nameExpr expr="(?!(if|while|for))[\w_]+"/>
        <nameExpr expr="[\w_]+(?=[\s]*::)"/>

Can someone help me

Thank you

How to&Answers:

We just need to add enter/add new line after close the class or function tag

So maybe this is a bug



For me the problem was that there was no closing PHP tag.

May be that helps someone.

Add a “?>” closing PHP tag if it is already not there.


There are several reasons why function list can’t render function tree.

  1. In older versions of Notepad++ PHP section closing tab is required. Just simple add ?> at the end of file. Sometimes after closing tab new line is required.
  2. functionList.xml incorrect parse PHP file. For example this function description broke function list rendering:
     * Unset an instance of this class.
     * @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset
    public function __destruct()
        $this->workbook = null;

In this case you must change (or add) commentExpr In functionList.xml in %APPDATA%
(There are two functionList.xml locations. Program Files directory and %APPDATA% directory)

    id         ="php_syntax"


The internal “function list” does not work at all for me. I tried to delete one or both “functionlist.xml” files, which was recommended at some sites, but nothing worked for me.

I prefer the plugin “functionList” from

with the Patch from

which works great with my Notepad++ 6.9.2


Replace in functionList.xml, the php parser. Use this new one you can find in the notepad++ forums ->


it can handle abstract class and functions.