<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>pnotepad.org forums &#187; Topic: RegEx Questions</title>
		<link>http://pnotepad.org/forums/topic/702</link>
		<description>Programmer&#039;s Notepad Forums</description>
		<language>en-US</language>
		<pubDate>Thu, 09 Feb 2012 06:14:45 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.3</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://pnotepad.org/forums/search.php</link>
		</textInput>
		<atom:link href="http://pnotepad.org/forums/rss/topic/702" rel="self" type="application/rss+xml" />

		<item>
                        <title>RegEx Questions (NickDMax)</title>
			<link>http://pnotepad.org/forums/topic/702#post-2559</link>
			<pubDate>Wed, 04 Nov 2009 08:12:33 +0000</pubDate>
			<dc:creator>NickDMax</dc:creator>
			<guid isPermaLink="false">2559@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Well for example today I needed to create a bunch of constants in some code. I generally like my constants to have all capital names. So I used a regex like this to get build the constants from an exported excel table:&#60;br /&#62;
Search: ^(\w+).*$&#60;br /&#62;
Replace: Public Const \1 as String = &#34;\1&#34;&#60;/p&#62;
&#60;p&#62;Then I had to go an highlight each identifier and hit ctrl-shift-U to make it upper case.&#60;/p&#62;
&#60;p&#62;It would have been nice to be able to have the replace string as something like:&#60;br /&#62;
Public Const $(u\1) as String = &#34;\1&#34;&#60;/p&#62;
&#60;p&#62;I *think* that xpressive may actually support \U \L formatting expression using the format_perl formatted -- but none of my attempts to get this to work have been successful and I can't find an example. &#60;/p&#62;
&#60;p&#62;If it is not feasible to add a little more functionality to the replacement format -- then allowing PyPN to get search results as an object would allow a PyPN script to preform the actual replacement function. Right now one would have to use the Python RegEx -- and I suppose there is nothing really wrong with that approach.&#60;/p&#62;
&#60;p&#62;BTW: The Boost bug report has been resolved so in boost 41 the error should be removed -- you were right those guys are on top of things.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>RegEx Questions (simon)</title>
			<link>http://pnotepad.org/forums/topic/702#post-2556</link>
			<pubDate>Tue, 03 Nov 2009 15:22:57 +0000</pubDate>
			<dc:creator>simon</dc:creator>
			<guid isPermaLink="false">2556@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Ah nice, I hadn't come across quoted sequences before - useful, shame about the bug!&#60;/p&#62;
&#60;p&#62;Named groups would be nice to support for search and replace, they're used all over PN for the tool output parsing and the like.&#60;/p&#62;
&#60;p&#62;Could you explain the plugin formatting further? I'm guessing you want some way to hand off the formatting of expressions in the replace box to a plugin? A scenario example would make this more clear.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>RegEx Questions (NickDMax)</title>
			<link>http://pnotepad.org/forums/topic/702#post-2555</link>
			<pubDate>Tue, 03 Nov 2009 15:22:21 +0000</pubDate>
			<dc:creator>NickDMax</dc:creator>
			<guid isPermaLink="false">2555@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;I created a Boost ticket #3586 for this.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>RegEx Questions (NickDMax)</title>
			<link>http://pnotepad.org/forums/topic/702#post-2554</link>
			<pubDate>Tue, 03 Nov 2009 14:55:49 +0000</pubDate>
			<dc:creator>NickDMax</dc:creator>
			<guid isPermaLink="false">2554@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Just a note: Don't try to use the regex: &#34;\Q.*\E&#34; -- this locks up. In fact from my tests I would say don't use a */+ inside a quoted sequence. The following works &#34;\Q([.])\E&#34; -- and will find any occurrences of &#34;([.])&#34; without having to use the regex &#34;\(\[\.\]\)&#34;. This only seems to affect usage of */+ inside of the quoted sequence.&#60;/p&#62;
&#60;p&#62;To test to ensure it was not a PN problem I used the following which locks up:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;#include &#38;lt;iostream&#38;gt;
#include &#38;lt;boost/xpressive/xpressive.hpp&#38;gt;

using namespace boost::xpressive;

int main()
{
    std::string hello( &#38;quot;hello .* world!&#38;quot; );

    std::cout &#38;lt;&#38;lt; &#38;quot;compile regex&#38;quot; &#38;lt;&#38;lt; std::endl;
    sregex rex = sregex::compile( &#38;quot;\\Q.*\\E&#38;quot; );
    smatch what;

    std::cout &#38;lt;&#38;lt; &#38;quot;Get Iterator&#38;quot; &#38;lt;&#38;lt; std::endl;
    sregex_iterator cur( hello.begin(), hello.end(), rex );
    sregex_iterator end;

    std::cout &#38;lt;&#38;lt; &#38;quot;begin search&#38;quot; &#38;lt;&#38;lt; std::endl;
    while( cur != end ) {
        smatch const &#38;amp;what = *cur;
        std::cout &#38;lt;&#38;lt; &#38;quot;found: &#38;quot; &#38;lt;&#38;lt; what[0] &#38;lt;&#38;lt; &#38;#39;\n&#38;#39;;
        cur++;
    }

    return 0;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;This locks up at the compile stage which explains why PN locks up given that regex. &#60;/p&#62;
&#60;p&#62;Hopefully we can get Xpressive to address this because oddly enough, searching for a regular expression inside of code is something that may come up within a Programmer's Notepad.&#60;/p&#62;
&#60;p&#62;However Simon I would like to say that the addition of XPressive is outstanding! It would be great if we could use some of the features like named groups and perhaps plug-in formatting (esp. PyPN scripts if that would be possible). &#60;/p&#62;
&#60;p&#62;I will try to update the wiki throughout this week (I think the bulk is already done).
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>RegEx Questions (NickDMax)</title>
			<link>http://pnotepad.org/forums/topic/702#post-2551</link>
			<pubDate>Mon, 02 Nov 2009 17:13:31 +0000</pubDate>
			<dc:creator>NickDMax</dc:creator>
			<guid isPermaLink="false">2551@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;I had read in your blog that you were looking into XPressive so this is what I thought that you were using. I will try it out in XPressive and let you know what I find. I do happen to be C++ friendly, and roughly familiar with Boost::XPressive. This information should also help me in bettering the wiki documentation.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>RegEx Questions (simon)</title>
			<link>http://pnotepad.org/forums/topic/702#post-2545</link>
			<pubDate>Sat, 31 Oct 2009 17:32:28 +0000</pubDate>
			<dc:creator>simon</dc:creator>
			<guid isPermaLink="false">2545@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Hi Nick,&#60;/p&#62;
&#60;p&#62;We're using Boost:XPressive for the library, and they've been very responsive with bugs in the past. It's worth trying with just that library (if you're C++ friendly) to check it's an XPressive bug rather than a PN bug.&#60;/p&#62;
&#60;p&#62;Simon.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>RegEx Questions (NickDMax)</title>
			<link>http://pnotepad.org/forums/topic/702#post-2540</link>
			<pubDate>Fri, 30 Oct 2009 17:13:32 +0000</pubDate>
			<dc:creator>NickDMax</dc:creator>
			<guid isPermaLink="false">2540@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;I was trying to update some of the wiki on Regular Expressions and found some oddities -- Though first a question:&#60;/p&#62;
&#60;p&#62;#1. What is the base for PN's Find/Replace RegEx? Boost::XPressive? Boost::Regex?&#60;/p&#62;
&#60;p&#62;Now The RegEx seems to support Look ahead/behind well enough:&#60;br /&#62;
'(.*)(?=ton)' -- seems to work.&#60;br /&#62;
'(?&#38;lt;=Apple)(.*)' -- seems to work.&#60;/p&#62;
&#60;p&#62;but the (?!...) and (?&#38;lt;!...) non-capture groups really seem to be buggy. They Work in some situations but seem to fall apart when combined with greedy quantifiers. &#60;/p&#62;
&#60;p&#62;'(?&#38;lt;!H)(.*)' will still match 'Hello' and&#60;br /&#62;
'(?&#38;lt;!H)([elo]*)' does not seem to match anything. (For example Bello Xello  etc).&#60;/p&#62;
&#60;p&#62;'(.)(?!e)' works fine&#60;br /&#62;
'(.*)(?!e)' Matches every line... (sort of makes sense since this regex matches to end of line charaters...but even things like '(.*)(?!e$)' fail.&#60;/p&#62;
&#60;p&#62;So I am looking for information on the RegEx library used so that I can get a feel for what should be updated in the Wiki.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>

