<?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>Unlock AI &#8211; About Things | A Hans Scharler Blog</title>
	<atom:link href="https://nothans.com/tag/unlock-ai/feed" rel="self" type="application/rss+xml" />
	<link>https://nothans.com</link>
	<description>Life, Comedy, Games, Tech, Marketing, and Community</description>
	<lastBuildDate>Wed, 01 Feb 2023 22:30:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/nothans.com/wp-content/uploads/2023/02/cropped-settings.png?fit=32%2C32&#038;ssl=1</url>
	<title>Unlock AI &#8211; About Things | A Hans Scharler Blog</title>
	<link>https://nothans.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">114568856</site>	<item>
		<title>Prompt Engineering: ChatGPT Prompts for Regular Expressions</title>
		<link>https://nothans.com/prompt-engineering-chatgpt-prompts-for-regular-expressions</link>
					<comments>https://nothans.com/prompt-engineering-chatgpt-prompts-for-regular-expressions#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Wed, 01 Feb 2023 22:30:26 +0000</pubDate>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[chatbot]]></category>
		<category><![CDATA[ChatGPT]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Prompt Engineering]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[Unlock AI]]></category>
		<guid isPermaLink="false">https://nothans.com/?p=3574</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<p><a href="https://en.wikipedia.org/wiki/Regular_expression" target="_blank" rel="noreferrer noopener">Regex</a> (Regular Expression) is a pattern-matching syntax used in various programming languages and tools for searching and manipulating strings.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="593" height="397" data-attachment-id="3575" data-permalink="https://nothans.com/prompt-engineering-chatgpt-prompts-for-regular-expressions/image-22" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-22.png?fit=593%2C397&amp;ssl=1" data-orig-size="593,397" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Regex Prompt Engineering in ChatGPT" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-22.png?fit=593%2C397&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-22.png?resize=593%2C397&#038;ssl=1" alt="" class="wp-image-3575" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-22.png?w=593&amp;ssl=1 593w, https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-22.png?resize=300%2C200&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-22.png?resize=420%2C280&amp;ssl=1 420w" sizes="(max-width: 593px) 100vw, 593px" /><figcaption class="wp-element-caption">Regex Prompt in ChatGPT</figcaption></figure>
</div>


<p>Regular Expressions can be used in various contexts, including:</p>



<ol class="wp-block-list">
<li>Text processing and manipulation</li>



<li>Data validation and pattern matching</li>



<li>Search and replace operations in text editors and IDEs</li>



<li>Web scraping and data extraction</li>



<li>Input validation in programming</li>
</ol>



<p>Regex is supported in many programming languages, including Python, Perl, Java, JavaScript, and Ruby.</p>



<p>I have lived with regex since my Perl days. There are a lot of rules surrounding them and programmers pride themselves on writing hard-to-read code using regex. If you remember all of the rules, you can figure out what a regex means, but I have been using ChatGPT to explain them to me when I see them.</p>


<h2 class="wp-block-heading" id="what-does-string-wsw-do-in-perl">What does &#8216;$string =~ /(\w+)\s(\w+)/&#8217; do in Perl?</h2>


<p><em>Just ask ChatGPT.</em></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>The expression <code>$string =~ /(\w+)\s(\w+)/</code> in Perl is a regular expression pattern match operation. It tries to match the pattern <code>(\w+)\s(\w+)</code> within the string <code>$string</code>. If the pattern matches, the matched substrings are stored in special variables <code>$1</code>, <code>$2</code>, etc.</p>



<p>The pattern <code>(\w+)\s(\w+)</code> consists of two sub-patterns <code>(\w+)</code> separated by a white space <code>\s</code>. Each sub-pattern matches one or more word characters <code>\w</code> and the plus sign <code>+</code> indicates to match one or more of the preceding expressions.</p>



<p>For example, if the string <code>$string</code> is <code>"The quick brown fox"</code>, the match will be successful and <code>$1</code> will contain the matched string <code>"The"</code>, and <code>$2</code> will contain <code>"quick"</code>.</p>
<cite>ChatGPT on What does &#8216;$string =~ /(\w+)\s(\w+)/&#8217; do in Perl?</cite></blockquote>


<h2 class="wp-block-heading" id="effective-prompt-engineering-for-regular-expressions-and-chatgpt">Effective Prompt Engineering for Regular Expressions and ChatGPT</h2>


<p>Using a chatbot like ChatGPT effectively is all about writing good prompts. Context really helps the chatbot understand the prompt and how to return accurate results.</p>



<ul class="wp-block-list">
<li>Start prompt with the programing language</li>



<li>Add Regex to the prompt</li>



<li>Ask for example code</li>



<li>Include a short description of the regex and specific rules (ignore case, match all occurrences, etc.)</li>



<li>Ask for an explanation or not</li>



<li>Ask for sample output or not</li>
</ul>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img data-recalc-dims="1" decoding="async" width="750" height="489" data-attachment-id="3576" data-permalink="https://nothans.com/prompt-engineering-chatgpt-prompts-for-regular-expressions/image-23" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-23.png?fit=1042%2C679&amp;ssl=1" data-orig-size="1042,679" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-23" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-23.png?fit=750%2C489&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-23.png?resize=750%2C489&#038;ssl=1" alt="" class="wp-image-3576" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-23.png?resize=1024%2C667&amp;ssl=1 1024w, https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-23.png?resize=300%2C195&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-23.png?resize=768%2C500&amp;ssl=1 768w, https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-23.png?resize=750%2C489&amp;ssl=1 750w, https://i0.wp.com/nothans.com/wp-content/uploads/2023/01/image-23.png?w=1042&amp;ssl=1 1042w" sizes="(max-width: 750px) 100vw, 750px" /><figcaption class="wp-element-caption">Example Regular Expression Prompt for ChatGPT</figcaption></figure>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/prompt-engineering-chatgpt-prompts-for-regular-expressions/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3574</post-id>	</item>
	</channel>
</rss>
