<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DotBert &#187; regex</title>
	<atom:link href="http://dotbert.loedeman.nl/category/regex/feed" rel="self" type="application/rss+xml" />
	<link>http://dotbert.loedeman.nl</link>
	<description>.NET thoughts by Bert Loedeman</description>
	<lastBuildDate>Wed, 19 Oct 2011 07:57:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Search and replace with Regular Expressions in Visual Studio .NET (2005)</title>
		<link>http://dotbert.loedeman.nl/search-and-replace-with-regular-expressions-in-visual-studio-net-2005</link>
		<comments>http://dotbert.loedeman.nl/search-and-replace-with-regular-expressions-in-visual-studio-net-2005#comments</comments>
		<pubDate>Fri, 10 Mar 2006 09:53:00 +0000</pubDate>
		<dc:creator>Bert Loedeman</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[search and replace]]></category>
		<category><![CDATA[visual studio 2005]]></category>
		<category><![CDATA[visual studio 2008]]></category>

		<guid isPermaLink="false">http://www.loedeman.net/wordpress/?p=13</guid>
		<description><![CDATA[Today I had to search and replace a text with a little variation in it in a very large project. This text looked like &#8216;if&#60;zero or more spaces&#62;(Null.IsNull(&#60;object name&#62;.&#60;variable name&#62;))&#8217;. I had to replace it with: &#8216;if (!&#60;object name&#62;.&#60;variable name&#62; &#62; 0))&#8217;. This turns out to be quite a job, especially when you are not [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had to search and replace a text with a little variation in it in a very large project. This text looked like &#8216;if&lt;zero or more spaces&gt;(Null.IsNull(&lt;object name&gt;.&lt;variable name&gt;))&#8217;. I had to replace it with: &#8216;if (!&lt;object name&gt;.&lt;variable name&gt; &gt; 0))&#8217;. This turns out to be quite a job, especially when you are not very experienced with Microsoft&#8217;s way of dealing with regular expressions. Finally I discovered a way to do the job. The expressions used for it are the following:</p>
<p>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>Search string:</td>
<td>if[ ]*\(Null.IsNull\({:c+.:c+}\)\)</td>
</tr>
<tr>
<td>Replacement string:</td>
<td>if (!(\1 &gt; 0))</td>
</tr>
</table>
<p>Note that the Regular Expression used to search does not entirely look likea normal RegEx. Microsoft seems to use their own kind of RegEx for search and replace. Important is that {} is not used to quantify like in RegEx (for instance: zo{1} matches &#8216;zo&#8217; but not &#8216;zoo&#8217;), but to generate a tagged expression, which can be used in the replacement string by giving in \x whereby x represents a 1-base number (1st replacement = \1 and so on).</p>
<p>Hope I have been of some help for anybody out there <img src='http://dotbert.loedeman.nl/wp-includes/images/smilies/icon_smile.gif' alt="Search and replace with Regular Expressions in Visual Studio .NET (2005) icon smile" class='wp-smiley' title="Search and replace with Regular Expressions in Visual Studio .NET (2005)" />  . Please do not be concerned about posting a comment/question. I&#8217;ll do what I can to answer you soon!</p>
<p>Bert</p>
]]></content:encoded>
			<wfw:commentRss>http://dotbert.loedeman.nl/search-and-replace-with-regular-expressions-in-visual-studio-net-2005/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

