<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Beautiful regular expressions code</title>
	<link>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/</link>
	<description>A blog on the development of the NGEDIT text editor</description>
	<pubDate>Tue, 06 Jan 2009 21:34:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
		<item>
		<title>By: The growing pains of NGEDIT &#187; Blog Archive &#187; Focusing my development effort</title>
		<link>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-242</link>
		<dc:creator>The growing pains of NGEDIT &#187; Blog Archive &#187; Focusing my development effort</dc:creator>
		<pubDate>Sat, 26 Nov 2005 15:16:24 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-242</guid>
		<description>[...] Well, the thing is that my tendency to drift off, my ambition, and my yearning for beautiful code kicked in. Instead of a simple solution, I found myself implementing the &#8220;ultimate&#8221; command line (of course). It&#8217;s already pretty much fully architected, and about half-working (although opening files from the command line ended up being just a small part of the available functionality). As I did this, I also started refactoring the part of the code that handles file loading into using my C++ string class that doesn&#8217;t suck, which is great, but it&#8217;s quite an effort by itself. Meanwhile, I found myself whining that I didn&#8217;t want to have all that code written using the non-portable Windows API (as a shortcut I took before summer, NGEDIT code is uglily using the Windows API directly in way too many places), so I started implementing an OS-independence layer (I know, I know, these things are better done from day 1, but you sometimes have to take shortcuts and that was one of many cases). Of course, with the OS-independence layer using said generic string class for the interface. And establishing a super-flexible application framework for NGEDIT, which was a bit cluttered to my taste. And sure, I started trying to establish the ultimate error-handling policy, which took me to posting about and researching C++ exceptions and some other fundamental problems of computing&#8230; [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Well, the thing is that my tendency to drift off, my ambition, and my yearning for beautiful code kicked in. Instead of a simple solution, I found myself implementing the &#8220;ultimate&#8221; command line (of course). It&#8217;s already pretty much fully architected, and about half-working (although opening files from the command line ended up being just a small part of the available functionality). As I did this, I also started refactoring the part of the code that handles file loading into using my C++ string class that doesn&#8217;t suck, which is great, but it&#8217;s quite an effort by itself. Meanwhile, I found myself whining that I didn&#8217;t want to have all that code written using the non-portable Windows API (as a shortcut I took before summer, NGEDIT code is uglily using the Windows API directly in way too many places), so I started implementing an OS-independence layer (I know, I know, these things are better done from day 1, but you sometimes have to take shortcuts and that was one of many cases). Of course, with the OS-independence layer using said generic string class for the interface. And establishing a super-flexible application framework for NGEDIT, which was a bit cluttered to my taste. And sure, I started trying to establish the ultimate error-handling policy, which took me to posting about and researching C++ exceptions and some other fundamental problems of computing&#8230; [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The growing pains of NGEDIT &#187; Blog Archive &#187; Long time no see</title>
		<link>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-166</link>
		<dc:creator>The growing pains of NGEDIT &#187; Blog Archive &#187; Long time no see</dc:creator>
		<pubDate>Fri, 28 Oct 2005 19:12:56 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-166</guid>
		<description>[...] The growing pains of NGEDIT A blog on the development of the NGEDIT text editor      &#171; Beautiful regular expressions code [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] The growing pains of NGEDIT A blog on the development of the NGEDIT text editor      &laquo; Beautiful regular expressions code [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J</title>
		<link>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-115</link>
		<dc:creator>J</dc:creator>
		<pubDate>Mon, 10 Oct 2005 12:47:49 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-115</guid>
		<description>I didn't know about the possesive quantifier - it seems quite doable. If I understand your example well, I would call it the super-greedy multi - it matches everything it can, but not happy with that, it won't accept nothing less that everything "the full cake". I'll still have to think about a syntax with which to implement it in vim. I think two '+'  signs is ok (or two '*' or two {2,3}'s).

Lookahead support is there in my regex engine - the node types NT_SAVE_IPOS and NT_JUMPTO_IPOS are there for that (as well as for \&#38; concats). vim also supports it, although the syntax is different from perl (I think it is \@= to make a zero-width match and some other operator to make zero-width non-match).

Not all of the stuff is working as of yet, but I hope to have it fully working by the end of the week. Only implementation details are missing. I designed the engine by following vim's dcumentation for regular expressions, and with the determination to make an engine powerful enough to handle all of it.</description>
		<content:encoded><![CDATA[<p>I didn&#8217;t know about the possesive quantifier - it seems quite doable. If I understand your example well, I would call it the super-greedy multi - it matches everything it can, but not happy with that, it won&#8217;t accept nothing less that everything &#8220;the full cake&#8221;. I&#8217;ll still have to think about a syntax with which to implement it in vim. I think two &#8216;+&#8217;  signs is ok (or two &#8216;*&#8217; or two {2,3}&#8217;s).</p>
<p>Lookahead support is there in my regex engine - the node types NT_SAVE_IPOS and NT_JUMPTO_IPOS are there for that (as well as for \&amp; concats). vim also supports it, although the syntax is different from perl (I think it is \@= to make a zero-width match and some other operator to make zero-width non-match).</p>
<p>Not all of the stuff is working as of yet, but I hope to have it fully working by the end of the week. Only implementation details are missing. I designed the engine by following vim&#8217;s dcumentation for regular expressions, and with the determination to make an engine powerful enough to handle all of it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-109</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 09 Oct 2005 23:28:37 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-109</guid>
		<description>Java reg-exp capabilities are summed up here :
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

The main advantage java has has over perl is the posessive quantifier '+'.
So whereas  J+JF would match JJJJF ,  J++JF would not. I havent found this overly useful.

When I meant full support, I guess I was thinking about lookaheads and lookbehinds.  As in "Easter (?!eggs)\w+"  matching  "Easter Monday"  or "Easter afdasdsadfa"  but not "Easter eggs". This can be damn handy but in the context of an editor you can always do a second filtering operation.  

CT</description>
		<content:encoded><![CDATA[<p>Java reg-exp capabilities are summed up here :<br />
<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html</a></p>
<p>The main advantage java has has over perl is the posessive quantifier &#8216;+&#8217;.<br />
So whereas  J+JF would match JJJJF ,  J++JF would not. I havent found this overly useful.</p>
<p>When I meant full support, I guess I was thinking about lookaheads and lookbehinds.  As in &#8220;Easter (?!eggs)\w+&#8221;  matching  &#8220;Easter Monday&#8221;  or &#8220;Easter afdasdsadfa&#8221;  but not &#8220;Easter eggs&#8221;. This can be damn handy but in the context of an editor you can always do a second filtering operation.  </p>
<p>CT</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J</title>
		<link>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-108</link>
		<dc:creator>J</dc:creator>
		<pubDate>Sun, 09 Oct 2005 21:46:01 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-108</guid>
		<description>Glad to hear someone else feels the pain! Well, actually I shouldn't be happy for anyone's pain, but I think it opens the way to innovation.

Regarding the non-greedy multi operators, you can see on the listing above NT_OPTIONAL_JUMP_PREF which is the opcode emitted when non-greedy operators are compiled - they are actually already working!

It's not complete, but only partial implementation stuff is missing - the whole compiler and matcher framework is there and supports everything necessary. It took a lot of effort to get the template-based design right.

What do you mean by "full reg-ex support"? I'm implementing full vi/vim reg-ex support, but I'm not aware of what perl/Java may do that vim doesn't (although I know some of the syntax details differ).

It would be great to hear what things are needed at this stage.

Thanks for the comments!</description>
		<content:encoded><![CDATA[<p>Glad to hear someone else feels the pain! Well, actually I shouldn&#8217;t be happy for anyone&#8217;s pain, but I think it opens the way to innovation.</p>
<p>Regarding the non-greedy multi operators, you can see on the listing above NT_OPTIONAL_JUMP_PREF which is the opcode emitted when non-greedy operators are compiled - they are actually already working!</p>
<p>It&#8217;s not complete, but only partial implementation stuff is missing - the whole compiler and matcher framework is there and supports everything necessary. It took a lot of effort to get the template-based design right.</p>
<p>What do you mean by &#8220;full reg-ex support&#8221;? I&#8217;m implementing full vi/vim reg-ex support, but I&#8217;m not aware of what perl/Java may do that vim doesn&#8217;t (although I know some of the syntax details differ).</p>
<p>It would be great to hear what things are needed at this stage.</p>
<p>Thanks for the comments!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-107</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 09 Oct 2005 21:34:46 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-107</guid>
		<description>BTW. I know full reg-exp support ala Perl/Java may be a way off if ever, but please make sure you support  the non-greedy '?' quantifier,  as in  "B.*?C+" matching (B)(AB)(CC).
  
This makes quick and dirty text file hacking with reg-exps significantly easier as you can filter out the noise without worrying about it overlapping your targets.</description>
		<content:encoded><![CDATA[<p>BTW. I know full reg-exp support ala Perl/Java may be a way off if ever, but please make sure you support  the non-greedy &#8216;?&#8217; quantifier,  as in  &#8220;B.*?C+&#8221; matching (B)(AB)(CC).</p>
<p>This makes quick and dirty text file hacking with reg-exps significantly easier as you can filter out the noise without worrying about it overlapping your targets.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-106</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 09 Oct 2005 21:28:16 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/10/09/beautiful-regular-expressions-code/#comment-106</guid>
		<description>wow. your throwaway comment stuck a chord. my obsession, sometimes excessive, about writing perfect code - even when most of it will never be seen by another - is because i want to be Right!

CT.</description>
		<content:encoded><![CDATA[<p>wow. your throwaway comment stuck a chord. my obsession, sometimes excessive, about writing perfect code - even when most of it will never be seen by another - is because i want to be Right!</p>
<p>CT.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
