<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Need help with functionlist regex]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">for a userdefinde language I try to use the functionlist. For the subs/functions this is already working. But I want to see in the function list also some special markings/infos.</p>
<p dir="auto">This is an example:</p>
<pre><code>'---------
' TestFile
'---------

'******************
'# blabla
'* &lt;&lt; Infoline 1 &gt;&gt;
'******************
'-------------------------------------------------------------------------------
'TestSub1
'-------------------------------------------------------------------------------
Sub TestSub1()



End Sub 'TestSub1


'-------------------------------------------------------------------------------
'TestSub2
'-------------------------------------------------------------------------------
Sub TestSub2()



End Sub 'TestSub2


'* Info Line 2! balbla

'-------------------------------------------------------------------------------
'TestFunction
'-------------------------------------------------------------------------------
Function TestFunction() As Integer

	TestFunction =

End Function 'TestFunction
</code></pre>
<p dir="auto">With this parser:</p>
<pre><code>			&lt;function
				mainExpr="^\s*(sub|function)\s+\K\w+"
			&gt;
			&lt;/function&gt;
</code></pre>
<p dir="auto">I get this list at the moment:</p>
<ul>
<li>TestSub1</li>
<li>TestSub2</li>
<li>TestFunction</li>
</ul>
<p dir="auto">What I want is</p>
<ul>
<li>&lt;&lt; Infoline 1 &gt;&gt;</li>
<li>TestSub1</li>
<li>TestSub2</li>
<li>Info Line 2! balbla</li>
<li>TestFunction</li>
</ul>
<p dir="auto">I tried this one</p>
<pre><code>			&lt;function
				mainExpr="^\s*((sub|function)\s+\K\w+|('*)\s+\K.*)"
			&gt;
			&lt;/function&gt;
</code></pre>
<p dir="auto">but without success.  Then nothing show up anymore in the list. Can someone help me with this? Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/14172/need-help-with-functionlist-regex</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 22:46:30 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/14172.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Jul 2017 13:01:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Need help with functionlist regex on Mon, 24 Jul 2017 06:17:01 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for the explanation.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25837</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25837</guid><dc:creator><![CDATA[MaDill]]></dc:creator><pubDate>Mon, 24 Jul 2017 06:17:01 GMT</pubDate></item><item><title><![CDATA[Reply to Need help with functionlist regex on Sat, 22 Jul 2017 14:37:24 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7673">@madill</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14">@mapje71</a>, and <strong>All</strong>,</p>
<p dir="auto"><strong>Updated</strong>  on 07-22-17 ( <strong><code>\v</code></strong> syntax <strong>added</strong> )</p>
<p dir="auto"><strong>MaDill</strong>, I, slightly, changed the <strong>mainExpr</strong> regex, as below :</p>
<p dir="auto"><strong><code>(?i)^\h*(?:(?-i:Sub|Function)\s+\K\w+|'\*\s+\K(?-s:.+))</code></strong></p>
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">At beginning, the part <strong><code>(?i)^\h*</code></strong> means that the search is, globally, case <strong>insensitive</strong> and that the key-words ( <strong><code>Sub</code></strong>, <strong><code>Function</code></strong> and <strong><code>'*</code></strong> may be preceded by <strong>optional tabulation</strong> and/or <strong>space</strong> characters</p>
</li>
<li>
<p dir="auto">Then, the <strong>general</strong> structure, which follows, is a <strong>non-capturing</strong> group, made of <strong>two</strong> alternatives ( <strong><code>(?:.....|......)</code></strong> )</p>
</li>
</ul>
<p dir="auto">, As I thought that the <strong>key-words</strong> <strong><code>Sub</code></strong> and <strong><code>Function</code></strong> must have that <strong>strict</strong> case, I decided to create the <strong>sensitive</strong> non-capturing group <strong><code>(?-i:Sub|Function)</code></strong></p>
<ul>
<li>
<p dir="auto">Any <strong>key-words</strong> must be followed by, at least, <strong>one</strong>, horizontal or vertical, <strong>White Space</strong> character  ( <strong><code>\s+</code></strong> )</p>
</li>
<li>
<p dir="auto">Finally, after the <strong>reset</strong> behaviour, due to the <strong><code>\K</code></strong> syntax, we display, in the <strong>Function List</strong> panel, either :</p>
<ul>
<li>
<p dir="auto">The <strong>name</strong> of current <strong>subroutine</strong> or <strong>function</strong> ( <strong><code>\w+</code></strong>, in case of key-words <strong>Sub</strong>/<strong>Function</strong></p>
</li>
<li>
<p dir="auto">All the <strong>rest</strong> of <strong>current</strong> line, only, <strong><code>(?-s:.+)</code></strong>, in case of <strong>key-word</strong> <strong><code>'\*</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">Do hope, you’ll like this <strong>interpretation</strong> ;-))</p>
<hr />
<p dir="auto">In all this <strong>discussion</strong>, we’re using, in <strong>regexes</strong>, either, the <strong><code>\s</code></strong> and/or the <strong><code>\h</code></strong> syntaxes. We could also add the <strong><code>\v</code></strong> syntax ! What they, all, refer to ?</p>
<p dir="auto">Well, from the Wiki article :</p>
<p dir="auto"><a href="https://en.wikipedia.org/wiki/Whitespace_character" rel="nofollow ugc">https://en.wikipedia.org/wiki/Whitespace_character</a></p>
<p dir="auto">we hear of the <strong><code>White Space</code></strong> definition, which is <strong>any</strong> character or <strong>series</strong> of characters, that represent <strong>horizontal</strong> or <strong>vertical</strong> space in <strong>typography</strong>. They, all, have the <strong>Unicode</strong> property <strong>“WSpace=Y”</strong>.</p>
<hr />
<p dir="auto">So, strictly :</p>
<ul>
<li>The <strong>Shorthand Character Class</strong> <strong><code>\s</code></strong>, used in the N++ <strong>Boost regex</strong> engine, matches any <strong>Vertical</strong> or <strong>Horizontal</strong> <strong><code>White Space</code></strong> character, of the list below :</li>
</ul>
<pre><code class="language-diff">U+0009			CHARACTER TABULATION
U+000A	
				LINE FEED
U+000B			VERTICAL TABULATION
U+000C			FORM FEED
U+000D	
				CARRIAGE RETURN
U+0020	 		SPACE
U+0085			NEXT LINE
U+00A0	 		NO-BREAK SPACE
U+1680	 		OGHAM SPACE MARK
U+2000	 		EN QUAD
U+2001	 		EM QUAD
U+2002	 		EN SPACE
U+2003	 		EM SPACE
U+2004	 		THREE-PER-EM SPACE
U+2005	 		FOUR-PER-EM SPACE
U+2006	 		SIX-PER-EM SPACE
U+2007	 		FIGURE SPACE
U+2008	 		PUNCTUATION SPACE
U+2009	 		THIN SPACE
U+200A	 		HAIR SPACE
U+2028	 		LINE SEPARATOR
U+2029	 		PARAGRAPH SEPARATOR
U+202F	 		NARROW NO-BREAK SPACE
U+205F	 		MEDIUM MATHEMATICAL SPACE
U+3000	　		IDEOGRAPHIC SPACE
</code></pre>
<p dir="auto">Moreover, it, also, matches the <strong>NON-WhiteSpace</strong> character, below :</p>
<pre><code class="language-diff">U+200B	​		ZERO WIDTH SPACE
</code></pre>
<ul>
<li>The <strong>Shorthand Character Class</strong> <strong><code>\h</code></strong>, used in the N++ <strong>Boost regex</strong> engine, matches any <strong>Horizontal</strong> <strong><code>White Space</code></strong> character, of the list below :</li>
</ul>
<pre><code class="language-diff">U+0009			CHARACTER TABULATION
U+0020	 		SPACE
U+00A0	 		NO-BREAK SPACE
U+1680	 		OGHAM SPACE MARK
U+2000	 		EN QUAD
U+2001	 		EM QUAD
U+2002	 		EN SPACE
U+2003	 		EM SPACE
U+2004	 		THREE-PER-EM SPACE
U+2005	 		FOUR-PER-EM SPACE
U+2006	 		SIX-PER-EM SPACE
U+2007	 		FIGURE SPACE
U+2008	 		PUNCTUATION SPACE
U+2009	 		THIN SPACE
U+200A	 		HAIR SPACE
U+202F	 		NARROW NO-BREAK SPACE
U+205F	 		MEDIUM MATHEMATICAL SPACE
U+3000	　		IDEOGRAPHIC SPACE
</code></pre>
<p dir="auto">As before, it, also, matches the <strong>NON-WhiteSpace</strong> character, below :</p>
<pre><code class="language-diff">U+200B	​		ZERO WIDTH SPACE
</code></pre>
<ul>
<li>The <strong>Shorthand Character Class</strong> <strong><code>\v</code></strong>, used in the N++ <strong>Boost regex</strong> engine, matches any <strong>Vertical</strong> <strong><code>White Space</code></strong> character, of the list below :</li>
</ul>
<pre><code class="language-diff">U+000A	
				LINE FEED
U+000B			VERTICAL TABULATION
U+000C			FORM FEED
U+000D	
				CARRIAGE RETURN
U+0085			NEXT LINE
U+2028	 		LINE SEPARATOR
U+2029	 		PARAGRAPH SEPARATOR
</code></pre>
<p dir="auto">And, logically, the <strong><code>\s</code></strong> <strong>class</strong> character is <strong>identical</strong> to the <strong>union</strong> of the <strong>two</strong> classes <strong><code>\h</code></strong> and <strong><code>\v</code></strong> !!</p>
<hr />
<p dir="auto">Luckily, most of these characters are <strong>never</strong> found, in <strong>Western</strong> scripts. Then, <strong>practically</strong>, we, just, have to remember that :</p>
<ul>
<li>
<p dir="auto">The <strong><code>\s</code></strong> syntax is, generally, <strong>identical</strong> to the simple class <strong><code>[\t\n\r\x20]</code></strong></p>
</li>
<li>
<p dir="auto">The <strong><code>\h</code></strong> syntax is, generally, <strong>identical</strong> to the simple class <strong><code>[\t\x20]</code></strong></p>
</li>
<li>
<p dir="auto">The <strong><code>\v</code></strong> syntax is, generally, <strong>identical</strong> to the simple class <strong><code>[\n\r]</code></strong></p>
</li>
</ul>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
<p dir="auto">BTW, <strong>MaDill</strong>, the <strong>MAPJe71</strong>’s last regex <strong>does</strong> work, properly, on my “old” <strong>Win WP</strong> configuration !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25794</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25794</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 22 Jul 2017 14:37:24 GMT</pubDate></item><item><title><![CDATA[Reply to Need help with functionlist regex on Fri, 21 Jul 2017 05:46:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> and <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14">@MAPJe71</a> The version from guy038 is working. I don’t know why the other one is working on your screenshot but not here. Thank you to both for your time and help. How can I set the topic to solved?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25781</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25781</guid><dc:creator><![CDATA[MaDill]]></dc:creator><pubDate>Fri, 21 Jul 2017 05:46:43 GMT</pubDate></item><item><title><![CDATA[Reply to Need help with functionlist regex on Thu, 20 Jul 2017 20:40:38 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7673">@madill</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14">@mapje71</a>,</p>
<p dir="auto">I found a <strong>solution</strong> :-)) To test it :</p>
<ul>
<li>
<p dir="auto">Open, in N++, your active <strong>functionList.xml</strong> file</p>
</li>
<li>
<p dir="auto">Add the line, below, inside the <strong>&lt;associationMap&gt;</strong> node :</p>
</li>
</ul>
<pre><code class="language-xml">			&lt;association id= "Test" langID="0" /&gt;
</code></pre>
<ul>
<li>Add the lines of the <strong>Test</strong> parser, below, inside the <strong>&lt;parsers&gt;</strong> node :</li>
</ul>
<pre><code class="language-xml">			&lt;parser	id ="Test" displayName="Ma_Dill_Test" commentExpr="'(?!\* )(?-s:.+)" &gt;
				&lt;function
					mainExpr="^\s*(sub|function)\s+\K\w+|^'\*\s+\K(?-s:.+)" &gt;
				&lt;/function&gt;
			&lt;/parser&gt;
</code></pre>
<ul>
<li>
<p dir="auto">Save the changes of <strong>functionList.xml</strong></p>
</li>
<li>
<p dir="auto"><strong>Close</strong> and <strong>re-start</strong> Notepad++</p>
</li>
<li>
<p dir="auto">Open a <strong>new</strong> tab</p>
</li>
<li>
<p dir="auto">Copy your <strong>example</strong> text of your <strong>first</strong> post, in this <strong>new</strong> tab</p>
</li>
<li>
<p dir="auto">Open the <strong>Function List</strong> panel ( <strong>View &gt; Function List</strong> )</p>
</li>
</ul>
<p dir="auto">=&gt; You should see your <strong>five</strong> functions, as you expect to !!</p>
<hr />
<p dir="auto">Notes :</p>
<ul>
<li>
<p dir="auto">I preferred to add the <strong>commentExpr</strong> part, which defines the <strong>line-comment</strong> zones to <strong>avoid</strong>, for further search of <strong>functions</strong> !</p>
</li>
<li>
<p dir="auto">As I supposed that lines, beginning with <strong><code>'*</code></strong> followed by some <strong>space</strong> characters, define special <strong>marking/infos</strong><br />
it becomes obvious that <strong>comment</strong> lines are lines which :</p>
<ul>
<li>
<p dir="auto">Begin by a single quote character ( <strong><code>'</code></strong> ), NOT followed by an asterisk + a “space” character <strong><code>'(?!\* )</code></strong>, which is a <strong>negative look-ahead</strong></p>
</li>
<li>
<p dir="auto">And followed by <strong>all standard</strong> characters of the <strong>current</strong> line =&gt; <strong><code>(?-s:.+)</code></strong>. The <strong><code>-s</code></strong> modifier is needed, because, by <strong>default</strong>, the <strong>Function List Regex</strong> engine considers <strong>all</strong> the text as a <strong>single</strong> line. ( So the regex <strong><code>.+</code></strong> would match any <strong>non-empty</strong> text, even on <strong>several</strong> lines. That is to say, <strong>all</strong> file contents ! )</p>
</li>
</ul>
</li>
<li>
<p dir="auto">In the <strong>mainExpr</strong> regex, I just add the alternative <strong><code>^'\*\s+\K(?-s).+</code></strong>, which looks, after <strong>beginning</strong> of line, for :</p>
<ul>
<li>
<p dir="auto">A <strong>single</strong> quote, followed with an *asterisk ( <strong><code>'\*</code></strong> ) and, at least, <strong>one</strong> character, of type = “<strong>space</strong>” ( <strong><code>\s+</code></strong> )</p>
</li>
<li>
<p dir="auto">Then, the syntax <strong><code>\K</code></strong> <strong>resets</strong> the regex search</p>
</li>
<li>
<p dir="auto">Finally, the part <strong><code>(?-s:.+)</code></strong>, again, looks for the <strong>remainder</strong> of the <strong>current</strong> line, only, due to the <strong><code>-s</code></strong> modifier, and is simply displayed, in the <strong>functionList</strong> panel !</p>
</li>
</ul>
</li>
</ul>
<hr />
<p dir="auto">BTW, <strong>Mapje71</strong>, the differences between your <strong>two</strong> posts, are the part <strong><code>(?m-s)</code></strong>, at <strong>beginning</strong> of the regex, in your <strong>last</strong> post ;-))</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25766</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25766</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 20 Jul 2017 20:40:38 GMT</pubDate></item><item><title><![CDATA[Reply to Need help with functionlist regex on Thu, 20 Jul 2017 19:31:20 GMT]]></title><description><![CDATA[<p dir="auto"><img src="https://camo.nodebb.org/487f83af5f1658f09638f41bef0701fc92e51a9f?url=https%3A%2F%2Fc1.staticflickr.com%2F5%2F4330%2F36050725935_717e5b7b0b_b.jpg" alt="" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/25758</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25758</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Thu, 20 Jul 2017 19:31:20 GMT</pubDate></item><item><title><![CDATA[Reply to Need help with functionlist regex on Thu, 20 Jul 2017 19:11:03 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">Is the reqex style of the functionlist somehow special?</p>
</blockquote>
<p dir="auto">AFAIK it isn’t.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25755</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25755</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Thu, 20 Jul 2017 19:11:03 GMT</pubDate></item><item><title><![CDATA[Reply to Need help with functionlist regex on Thu, 20 Jul 2017 16:05:37 GMT]]></title><description><![CDATA[<p dir="auto">Thank you again. With this regex the sub/function is working again. But the '* still not. Is the reqex style of the functionlist somehow special?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25746</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25746</guid><dc:creator><![CDATA[MaDill]]></dc:creator><pubDate>Thu, 20 Jul 2017 16:05:37 GMT</pubDate></item><item><title><![CDATA[Reply to Need help with functionlist regex on Thu, 20 Jul 2017 12:03:41 GMT]]></title><description><![CDATA[<pre><code class="language-XML">	&lt;function
		mainExpr="(?m-s)^\h*(?:(?i:sub|function)\s+\K\w+|\x27\*\h+\K.*)"
	/&gt;
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/25739</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25739</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Thu, 20 Jul 2017 12:03:41 GMT</pubDate></item><item><title><![CDATA[Reply to Need help with functionlist regex on Thu, 20 Jul 2017 05:31:38 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for the information. But even with the * it is not working. Nothing is show up in the list. Even not the sub|function anymore. I tried it on <a href="https://regex101.com/" rel="nofollow ugc">https://regex101.com/</a> and there it highlight what I’m looking for, but not in the functionlist. Do you have another hint?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25732</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25732</guid><dc:creator><![CDATA[MaDill]]></dc:creator><pubDate>Thu, 20 Jul 2017 05:31:38 GMT</pubDate></item><item><title><![CDATA[Reply to Need help with functionlist regex on Wed, 19 Jul 2017 17:47:14 GMT]]></title><description><![CDATA[<p dir="auto">Try:</p>
<pre><code class="language-XML">            &lt;function
                mainExpr="^\s*((sub|function)\s+\K\w+|'\*\s+\K.*)"
            &gt;
            &lt;/function&gt;
</code></pre>
<p dir="auto">The <code>*</code> is a special character in RegEx’s, you need to escape it to match it literally.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25722</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25722</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Wed, 19 Jul 2017 17:47:14 GMT</pubDate></item></channel></rss>