<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pattern Matching on AI VOID</title><link>https://ai-blog.noorshomelab.dev/tags/pattern-matching/</link><description>Recent content in Pattern Matching on AI VOID</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 20 Mar 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://ai-blog.noorshomelab.dev/tags/pattern-matching/index.xml" rel="self" type="application/rss+xml"/><item><title>Core Concepts: Structs, Enums, and Pattern Matching</title><link>https://ai-blog.noorshomelab.dev/rust-guide/core-concepts-structs-enums-pattern-matching/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-guide/core-concepts-structs-enums-pattern-matching/</guid><description>&lt;h1 id="core-concepts-structs-enums-and-pattern-matching"&gt;Core Concepts: Structs, Enums, and Pattern Matching&lt;/h1&gt;
&lt;p&gt;As your programs grow, you&amp;rsquo;ll need ways to define custom data types that logically group related pieces of data. Rust provides &lt;code&gt;structs&lt;/code&gt; and &lt;code&gt;enums&lt;/code&gt; for this purpose. Combined with &lt;code&gt;pattern matching&lt;/code&gt;, these features allow you to write expressive, robust, and type-safe code.&lt;/p&gt;
&lt;h2 id="structs"&gt;Structs&lt;/h2&gt;
&lt;p&gt;Structs are custom data types that let you name and package together multiple related values into a meaningful group. Each piece of data in a struct is called a &lt;em&gt;field&lt;/em&gt;.&lt;/p&gt;</description></item><item><title>Chapter 6: Structs, Enums, and Powerful Pattern Matching</title><link>https://ai-blog.noorshomelab.dev/rust-mastery-2026/structs-enums-pattern-matching/</link><pubDate>Fri, 20 Mar 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-mastery-2026/structs-enums-pattern-matching/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Welcome back, Rustaceans! In our previous chapters, we laid the groundwork for understanding Rust&amp;rsquo;s core syntax, variables, and the unique concept of ownership. Now, it&amp;rsquo;s time to elevate our data modeling capabilities beyond simple scalars. Imagine trying to describe a person or a color using just individual &lt;code&gt;i32&lt;/code&gt;s or &lt;code&gt;String&lt;/code&gt;s – it would quickly become cumbersome and error-prone.&lt;/p&gt;
&lt;p&gt;This chapter introduces you to Rust&amp;rsquo;s powerful tools for creating custom data types: &lt;strong&gt;structs&lt;/strong&gt; and &lt;strong&gt;enums&lt;/strong&gt;. Structs allow you to group related pieces of data into a single, meaningful unit, much like objects in other languages (but without methods initially). Enums, short for enumerations, let you define a type that can be one of several possible variants, perfect for situations where a value can be &lt;em&gt;either&lt;/em&gt; this &lt;em&gt;or&lt;/em&gt; that.&lt;/p&gt;</description></item><item><title>Chapter 8: Robust Error Handling with Result, Option, and the &amp;#39;?&amp;#39; Operator</title><link>https://ai-blog.noorshomelab.dev/rust-mastery-2026/robust-error-handling/</link><pubDate>Fri, 20 Mar 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-mastery-2026/robust-error-handling/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Welcome back, Rustaceans! In the journey of building reliable software, how we handle unexpected situations or failures is paramount. Imagine a program trying to read a file that doesn&amp;rsquo;t exist, or convert text into a number when the text isn&amp;rsquo;t actually a number. In many languages, these situations might lead to crashes or obscure runtime errors.&lt;/p&gt;
&lt;p&gt;Rust, with its strong emphasis on safety and reliability, takes a different approach. Instead of traditional exceptions or returning &lt;code&gt;null&lt;/code&gt; (which often leads to &amp;ldquo;billion-dollar mistakes&amp;rdquo;), Rust uses powerful enums called &lt;code&gt;Option&lt;/code&gt; and &lt;code&gt;Result&lt;/code&gt; to explicitly represent the &lt;em&gt;possibility&lt;/em&gt; of absence or failure. This chapter will unlock the secrets to robust error handling, making your Rust applications resilient and predictable.&lt;/p&gt;</description></item><item><title>Pattern Power: Regex Fast-Track - JavaScript &amp;amp; Python Essentials</title><link>https://ai-blog.noorshomelab.dev/cut-the-chase/regex-fast-track/</link><pubDate>Sat, 27 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/cut-the-chase/regex-fast-track/</guid><description>&lt;h1 id="pattern-power-regex-fast-track"&gt;Pattern Power: Regex Fast-Track&lt;/h1&gt;
&lt;p&gt;Regular Expressions (Regex) for text pattern matching. Current versions: Python 3.12, JavaScript (ECMAScript 2024/ES15).&lt;/p&gt;
&lt;h2 id="core-syntax"&gt;Core Syntax&lt;/h2&gt;
&lt;p&gt;Regex literals (JS) or compiled patterns (Python) define the search pattern. Flags modify behavior.&lt;/p&gt;
&lt;div class="highlight"&gt;
&lt;pre class="language-javascript line-numbers" data-start="1" tabindex="0"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;// JavaScript: Regex literal (preferred for static patterns)
const reLiteral = /abc/i; // Matches &amp;#34;abc&amp;#34; case-insensitively
// JavaScript: RegExp constructor (for dynamic patterns from strings)
const patternString = &amp;#34;xyz&amp;#34;;
const reConstructor = new RegExp(patternString, &amp;#39;g&amp;#39;); // Matches &amp;#34;xyz&amp;#34; globally
// Test method returns boolean
console.log(reLiteral.test(&amp;#34;ABC&amp;#34;)); // true
console.log(reConstructor.test(&amp;#34;0xyz1xyz2&amp;#34;)); // true&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;div class="highlight"&gt;
&lt;pre class="language-python line-numbers" data-start="1" tabindex="0"&gt;&lt;code class="language-python" data-lang="python"&gt;import re
# Python: Compile a regex pattern (preferred for repeated use)
pattern_compiled = re.compile(r&amp;#34;abc&amp;#34;, re.IGNORECASE) # Matches &amp;#34;abc&amp;#34; case-insensitively
# Python: Direct function call (for one-off uses)
match_obj = re.search(r&amp;#34;xyz&amp;#34;, &amp;#34;0xyz1xyz2&amp;#34;, re.M) # Searches for &amp;#34;xyz&amp;#34; in the string
# Match object evaluates to True if a match is found
print(bool(pattern_compiled.search(&amp;#34;ABC&amp;#34;))) # True
print(bool(match_obj)) # True&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;h2 id="essential-patterns"&gt;Essential Patterns&lt;/h2&gt;
&lt;p&gt;Character classes simplify matching common types of characters. Quantifiers specify how many times a character or group must appear.&lt;/p&gt;</description></item></channel></rss>