<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Juma Evans</title>
    <description>The latest articles on DEV Community by Juma Evans (@juma_evans_34e389ef539266).</description>
    <link>https://dev.to/juma_evans_34e389ef539266</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3732908%2F19cec6b2-04a4-4223-b322-6ee75277321f.png</url>
      <title>DEV Community: Juma Evans</title>
      <link>https://dev.to/juma_evans_34e389ef539266</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/juma_evans_34e389ef539266"/>
    <language>en</language>
    <item>
      <title>Goroutines vs. Promises: Why Go and JavaScript Look at Concurrency Completely Differently</title>
      <dc:creator>Juma Evans</dc:creator>
      <pubDate>Mon, 25 May 2026 07:43:46 +0000</pubDate>
      <link>https://dev.to/juma_evans_34e389ef539266/goroutines-vs-promises-why-go-and-javascript-look-at-concurrency-completely-differently-24ja</link>
      <guid>https://dev.to/juma_evans_34e389ef539266/goroutines-vs-promises-why-go-and-javascript-look-at-concurrency-completely-differently-24ja</guid>
      <description>&lt;p&gt;Handling concurrency is one of the most critical decisions in modern software architecture. When applications need to handle thousands of simultaneous tasks—like serving HTTP requests, streaming data, or background processing. The design of a language’s concurrency model dictates how easily developers can write fast, safe, and maintainable code.&lt;br&gt;
​Go is famous for making concurrency a native, deeply integrated primitive through goroutines and channels. To truly appreciate Go's design, it helps to contrast it with JavaScript, which handles concurrency using a completely different philosophy: a single-threaded Event Loop fueled by asynchronous non-blocking I/O.&lt;br&gt;
​Here is an architectural deep dive into Go's multi-threaded concurrency engine and how it measures up against JavaScript's single-threaded asynchronous model.&lt;/p&gt;

&lt;p&gt;​&lt;strong&gt;&lt;em&gt;Part 1: The Foundations of Go Concurrency&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
​Go’s concurrency model is based on a paper by C.A.R. Hoare called Communicating Sequential Processes (CSP). The core philosophy of CSP in Go can be summarized by its most famous mantra:&lt;br&gt;
​&lt;strong&gt;"Do not communicate by sharing memory; instead, share memory by communicating."&lt;/strong&gt;&lt;br&gt;
​Instead of having multiple threads fight over the same piece of memory using complex locks, mutexes, and semaphores, Go encourages developers to run independent processes (goroutines) that pass data back and forth through safe conduits (channels).&lt;/p&gt;

&lt;p&gt;​&lt;strong&gt;&lt;em&gt;Primitives: Goroutines and Channels&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
​Go replaces heavy, operating system-level threads with goroutines.&lt;br&gt;
​Goroutines: They are incredibly lightweight, starting with a stack size of just a few kilobytes (typically 2KB), which can grow and shrink dynamically. Because they require so little overhead, a single Go application can easily spin up hundreds of thousands of concurrent goroutines without exhausting system memory.&lt;br&gt;
​Channels: These are typed pipelines that allow goroutines to synchronize and exchange data. By default, channels are unbuffered, meaning a sender will block until a receiver is ready to take the data, creating natural synchronization points without manual locks.&lt;br&gt;
​The Magic Under the Hood: The M:N Scheduler&lt;br&gt;
​Go achieves this high efficiency using its internal Go Runtime Scheduler, often referred to as the GMP Model:&lt;br&gt;
​G (Goroutine): Represents the goroutine, its stack, and current status.&lt;br&gt;
​M (Machine): Represents a physical, OS-level thread managed by the operating system kernel.&lt;br&gt;
​P (Processor): Represents a logical resource or context required to execute Go code. The number of Ps usually matches the machine's physical CPU cores.&lt;br&gt;
​The scheduler assigns multiple goroutines (G) onto a smaller pool of OS threads (M) via the logical processors (P).&lt;br&gt;
​If a goroutine performs a blocking action, such as waiting for a network response or a file read—the Go runtime is smart enough to swap out that blocked goroutine, move the remaining active goroutines to a different OS thread, and keep the CPU busy. This concept is known as work-stealing, and it happens completely automatically behind the scenes. &lt;/p&gt;

&lt;p&gt;​&lt;strong&gt;Part 2: Go Concurrency in Action&lt;/strong&gt;&lt;br&gt;
​Writing concurrent code in Go requires very little boilerplate. You simply prefix a function call with the go keyword.&lt;br&gt;
​Here is a practical pattern: a worker pool where multiple concurrent workers process jobs sent via a channel, and report their progress safely.&lt;/p&gt;

&lt;p&gt;package main&lt;/p&gt;

&lt;p&gt;import (&lt;br&gt;
    "fmt"&lt;br&gt;
    "sync"&lt;br&gt;
    "time"&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;// worker processes incoming jobs from the jobs channel&lt;br&gt;
func worker(id int, jobs &amp;lt;-chan int, results chan&amp;lt;- int, wg *sync.WaitGroup) {&lt;br&gt;
    defer wg.Done() // Signal completion when the worker exits&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for job := range jobs {
    fmt.Printf("Worker %d started job %d\n", id, job)
    time.Sleep(time.Millisecond * 100) // Simulating an I/O task
    results &amp;lt;- job * 2
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;func main() {&lt;br&gt;
    numJobs := 5&lt;br&gt;
    jobs := make(chan int, numJobs)&lt;br&gt;
    results := make(chan int, numJobs)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var wg sync.WaitGroup

// Spin up 3 concurrent workers
for w := 1; w &amp;lt;= 3; w++ {
    wg.Add(1)
    go worker(w, jobs, results, &amp;amp;wg)
}

// Send jobs to the channel
for j := 1; j &amp;lt;= numJobs; j++ {
    jobs &amp;lt;- j
}
close(jobs) // Closing tells workers no more jobs are coming

// Wait for all workers to finish in the background
go func() {
    wg.Wait()
    close(results)
}()

// Collect all results
for res := range results {
    fmt.Printf("Result processed: %d\n", res)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 3: The Contender&lt;/strong&gt;&lt;br&gt;
 How JavaScript Handles Asynchrony&lt;br&gt;
​While Go provides a multi-threaded runtime that automatically abstracts away hardware limitations, JavaScript takes an entirely opposite approach. JavaScript's core philosophy is single-threaded simplicity driven by an Event Loop.&lt;br&gt;
​JavaScript operates on exactly one thread of execution (the main thread). It cannot natively execute two mathematical formulas simultaneously on different CPU cores. To prevent this single thread from freezing when downloading data or reading files, JavaScript relies on Asynchronous Non-Blocking I/O.&lt;/p&gt;

&lt;p&gt;​&lt;strong&gt;Primitives: Promises and Async/Await&lt;/strong&gt;&lt;br&gt;
​Instead of lightweight threads, JavaScript relies on Promises and state management.&lt;br&gt;
​&lt;strong&gt;Promises:&lt;/strong&gt; A Promise is an object representing the eventual completion (or failure) of an asynchronous operation. When a network request is fired, JavaScript leaves a Promise placeholder and immediately frees up the main thread to handle other UI interactions or requests.&lt;br&gt;
​&lt;strong&gt;Async/Await:&lt;/strong&gt; Syntactic sugar built over Promises. When you mark a function as async, it pauses execution inside that specific function when it hits an await keyword, returning control of the main thread back to the runtime execution engine until the background task is ready.&lt;/p&gt;

&lt;p&gt;​&lt;strong&gt;The Engine: The Event Loop&lt;/strong&gt;&lt;br&gt;
​Because JavaScript doesn't have a multi-threaded scheduler, it passes heavy lifting (like cryptography, network calls, or disk interactions) off to its container environment (the browser's Web APIs or Node.js background thread pool).&lt;br&gt;
​Once those background operations finish, they drop their callbacks into a Task Queue. The Event Loop constantly monitors the main thread. If the main thread is empty, it grabs the next task from the queue and executes it.&lt;br&gt;
​Let's look at how JavaScript achieves a similar worker execution strategy using Promises and Promise.all:&lt;br&gt;
// Simulating an asynchronous job&lt;br&gt;
async function worker(id, job) {&lt;br&gt;
  console.log(&lt;code&gt;Worker ${id} started job ${job}&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;// Simulating an I/O task (like a database query) using a non-blocking timeout&lt;br&gt;
  await new Promise(resolve =&amp;gt; setTimeout(resolve, 100)); &lt;/p&gt;

&lt;p&gt;return job * 2;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;async function main() {&lt;br&gt;
  const jobs = [1, 2, 3, 4, 5];&lt;/p&gt;

&lt;p&gt;// Map our jobs into an array of concurrent Promises.&lt;br&gt;
  // JavaScript kicks them all off immediately in the background.&lt;br&gt;
  const workerPromises = jobs.map((job, index) =&amp;gt; {&lt;br&gt;
    const workerId = (index % 3) + 1; // Distribute across 3 simulated workers&lt;br&gt;
    return worker(workerId, job);&lt;br&gt;
  });&lt;/p&gt;

&lt;p&gt;// Wait for all background tasks to finish and collect results&lt;br&gt;
  const results = await Promise.all(workerPromises);&lt;/p&gt;

&lt;p&gt;results.forEach(res =&amp;gt; {&lt;br&gt;
    console.log(&lt;code&gt;Result processed: ${res}&lt;/code&gt;);&lt;br&gt;
  });&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;main();&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 4: Head-to-Head Comparison&lt;/strong&gt;&lt;br&gt;
​To understand which paradigm fits a project best, we have to look at the architectural trade-offs between Go's implicit multi-threaded runtime and JavaScript's single-threaded execution queue.&lt;br&gt;
&lt;strong&gt;a. Primary Model &amp;amp; Execution Strategy&lt;/strong&gt;&lt;br&gt;
​&lt;strong&gt;The Go Way:&lt;/strong&gt; Uses Communicating Sequential Processes (CSP). Concurrency is handled by spinning up independent, lightweight threads (goroutines) that communicate safely by passing data through typed conduits called channels.&lt;br&gt;
​&lt;strong&gt;The JS Way:&lt;/strong&gt; Uses an Event-Driven Architecture. Concurrency is handled on a single main thread via an Event Loop that relies on Promises and callbacks to manage tasks asynchronously.&lt;/p&gt;

&lt;p&gt;​&lt;strong&gt;b. Hardware &amp;amp; CPU Utilization&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;​The Go Way:&lt;/strong&gt; Multi-threaded by default. Go’s built-in scheduler automatically distributes workloads across all available physical CPU cores, allowing for true, simultaneous hardware parallelism.&lt;br&gt;
​&lt;strong&gt;The JS Way:&lt;/strong&gt; Single-threaded by default. It executes code on only one CPU core. While it can handle thousands of tasks concurrently by overlapping wait times, it cannot execute tasks simultaneously on the same thread.&lt;br&gt;
​&lt;strong&gt;c. Task Mechanism &amp;amp; Memory Overhead&lt;/strong&gt;&lt;br&gt;
​&lt;strong&gt;The Go Way:&lt;/strong&gt; Driven by Goroutines, which are managed entirely by the Go runtime rather than the OS. They are incredibly lightweight, starting with a tiny memory footprint of just around 2KB per goroutine.&lt;br&gt;
​&lt;strong&gt;The JS Way:&lt;/strong&gt; Driven by Promises and Async/Await. These are not threads, but rather JavaScript object state machines that track the progress of a background task, carrying the memory overhead of the V8 JavaScript engine.&lt;/p&gt;

&lt;p&gt;​&lt;strong&gt;d. Handling Heavy Math and Computation&lt;/strong&gt;&lt;br&gt;
​&lt;strong&gt;The Go Way:&lt;/strong&gt; Excellent. Because it can utilize multiple CPU cores, heavy computations, data processing, or cryptography can run in the background without affecting or slowing down the rest of the application.&lt;br&gt;
​&lt;strong&gt;The JS Way:&lt;/strong&gt; Weak. Because everything runs on a single thread, any heavy mathematical calculation or CPU-bound task will completely freeze the Event Loop, stalling the entire application until the calculation finishes.&lt;/p&gt;

&lt;p&gt;​&lt;strong&gt;e.Inter-Task Communication&lt;/strong&gt;&lt;br&gt;
​&lt;strong&gt;The Go Way:&lt;/strong&gt; Features Native Typed Channels. This built-in primitive allows goroutines to pass data to one another seamlessly, acting as a natural synchronization barrier without needing manual memory locks.&lt;br&gt;
​&lt;strong&gt;The JS Way:&lt;/strong&gt; Relies on patterns like EventEmitters, Streams, or Async Generators. Because there is only one thread, tasks don't need to coordinate memory access, but streaming data requires using event-based libraries.&lt;/p&gt;

&lt;p&gt;​&lt;strong&gt;f.Task Control and Preemption&lt;/strong&gt;&lt;br&gt;
​&lt;strong&gt;The Go Way:&lt;/strong&gt; Supports Preemption. The Go runtime scheduler is highly intelligent; if it notices a single goroutine is acting greedily and hogging a CPU core for too long, it will forcefully pause it to give other tasks a turn.&lt;br&gt;
​&lt;strong&gt;The JS Way:&lt;/strong&gt; Has No Preemption. JavaScript code is strictly cooperative. If a function contains a long, synchronous loop that doesn't include an await keyword, it will hold the entire main thread hostage until it completes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;True Parallelism vs. Non-Blocking Concurrency&lt;/strong&gt;
​The ultimate mechanical difference is Parallelism vs. Concurrency.
​Go is capable of parallelism. If you have an 8-core CPU processor, Go can run 8 different computing tasks at the exact same millisecond. If one goroutine goes rogue and gets stuck in an infinite mathematical calculation loop, Go's scheduler will forcefully step in (preemption), pause it, and use the other CPU cores to keep your application running smoothly.
​JavaScript is strictly concurrent but serial. It excels at waiting without locking things up. If 1,000 users request data from a database at once, JavaScript fires off all 1,000 queries to the OS database drivers immediately, moves on to do other things, and handles the results one by one as they crawl back. However, if you give JavaScript a heavy mathematical equation to calculate, it cannot delegate it to another core—the entire server or UI freezes completely until that calculation finishes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;​2. &lt;strong&gt;Synchronization and Data Safety&lt;/strong&gt;&lt;br&gt;
​Because Go shares memory across actual physical CPU threads, it introduces the danger of Data Races (two threads trying to change the exact same memory address at the same time). Go provides channels to prevent this, but if developers get careless, they must use manual mutex locks (sync.Mutex) or run Go's runtime race detector (go run -race) to find hidden multi-threading bugs.&lt;br&gt;
​JavaScript completely bypasses data races by design. Because everything ultimately executes on a single main thread, you never have to worry about two blocks of code altering a variable at the exact same millisecond. This completely eliminates a massive category of complex, hard-to-track multi-threading bugs.&lt;/p&gt;

&lt;p&gt;​3. &lt;strong&gt;Memory &amp;amp; Resource Footprint&lt;/strong&gt;&lt;br&gt;
​Go's goroutines are remarkably lightweight (~2KB), but they still carry the overhead of an active, multi-threaded runtime scheduler and an internal Garbage Collector that scans heap allocations across threads.&lt;br&gt;
​JavaScript's basic Promises are incredibly cheap state objects, but because JavaScript runs inside engines like Google's V8, its base memory baseline per application instance is significantly larger than a compiled, lean Go binary.&lt;br&gt;
​&lt;strong&gt;Conclusion: Which tool is right for the job?&lt;/strong&gt;&lt;br&gt;
​Choose Go if you are building data-intensive microservices, streaming platforms, heavy background computing tools, or high-throughput network APIs. Go gives your application the muscle to exploit your hardware's full multi-core capacity effortlessly.&lt;br&gt;
​Choose JavaScript if you are building fast I/O bound applications like standard CRUD web APIs, web sockets, or real-time chat apps where the vast majority of execution time is spent passing data back and forth from databases. JavaScript keeps code straightforward, predictable, and exceptionally easy to debug.&lt;br&gt;
​Both ecosystems solved the ancient problem of traditional, clunky OS multi-threading, Go by building a highly advanced multi-threaded coordination engine, and JavaScript by proving exactly how much you can achieve on a single thread if you just learn how to wait effectively.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>productivity</category>
      <category>javascript</category>
      <category>go</category>
    </item>
    <item>
      <title>Regulalar Expression</title>
      <dc:creator>Juma Evans</dc:creator>
      <pubDate>Wed, 13 May 2026 01:47:34 +0000</pubDate>
      <link>https://dev.to/juma_evans_34e389ef539266/regulalar-expression-1e8p</link>
      <guid>https://dev.to/juma_evans_34e389ef539266/regulalar-expression-1e8p</guid>
      <description>&lt;h2&gt;
  
  
  Mastering Regular Expressions in JavaScript: From Basics to Real-World Validation
&lt;/h2&gt;

&lt;p&gt;At first glance, a regex pattern looks like a cat walked across your keyboard,a chaotic string of slashes, brackets, and symbols. However, once you decode the syntax, it becomes one of the most powerful tools in your developer toolkit.&lt;br&gt;
Below is the break down of how regex works in JavaScript and build a robust pattern to validate something we use every day: &lt;strong&gt;email addresses&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a Regular Expression anyways?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Regular Expression&lt;/strong&gt; is an object that describes a pattern of characters. In JavaScript, you can create them in two ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Literal Notation:&lt;/strong&gt; /pattern/flags&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Constructor:&lt;/strong&gt; new RegExp('pattern', 'flags')
### The Core Building Blocks
Before we tackle the email login, we need to understand the "alphabet" of regex:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Character Classes:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;\d: Matches any digit (0-9).&lt;/li&gt;
&lt;li&gt;\w: Matches any alphanumeric character (letters, numbers, and underscores).&lt;/li&gt;
&lt;li&gt;\s: Matches whitespace (spaces, tabs).&lt;/li&gt;
&lt;li&gt;.: The wildcard—matches any character except a newline.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quantifiers:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;+: Matches 1 or more of the preceding element.&lt;/li&gt;
&lt;li&gt;*: Matches 0 or more.&lt;/li&gt;
&lt;li&gt;{n,m}: Matches between n and m times.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anchors:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;^: Forces the match to start at the beginning of the string.&lt;/li&gt;
&lt;li&gt;$: Forces the match to end at the end of the string.
### Deep Dive: Validating an Email Address
When we log in to a platform, the first line of defense is ensuring the input actually looks like an email. Let’s build a regex for a standard email like &lt;a href="mailto:zone01.recode@company.co.ke"&gt;zone01.recode@company.co.ke&lt;/a&gt;.
#### 1. The Local Part (zone01 .recode)
We want to allow letters, numbers, dots, and underscores.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pattern:&lt;/strong&gt; ^[a-zA-Z0-9._%+-]+&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explanation:&lt;/strong&gt; We start at the beginning (^) and allow a set of characters inside the square brackets. The + ensures there is at least one character.
#### 2. The "@" Symbol
We just need the literal character.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pattern:&lt;/strong&gt; @
#### 3. The Domain (company)
Similar to the local part, but usually without the special symbols.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pattern:&lt;/strong&gt; [a-zA-Z0-9.-]+
#### 4. The TLD (.co.ke or .com)
We need a literal dot, followed by letters. Since a dot . is a wildcard in regex, we must &lt;strong&gt;escape&lt;/strong&gt; it with a backslash ..&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pattern:&lt;/strong&gt; .[a-zA-Z]{2,}$&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explanation:&lt;/strong&gt; This looks for a dot and at least two letters at the very end of the string ($).
#### Putting it all together:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;emailRegex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/^&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;a-zA-Z0-9._%+-&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;+@&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;a-zA-Z0-9.-&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;+&lt;/span&gt;&lt;span class="se"&gt;\.[&lt;/span&gt;&lt;span class="sr"&gt;a-zA-Z&lt;/span&gt;&lt;span class="se"&gt;]{2,}&lt;/span&gt;&lt;span class="sr"&gt;$/&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;testEmail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dev_user123@zone01.edu&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;emailRegex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;testEmail&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// Output: true&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Common Use Cases in Web Apps
&lt;/h3&gt;

&lt;p&gt;Beyond login forms, regex is used everywhere in full-stack development:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Password Strength:&lt;/strong&gt; Checking for at least one capital letter, one number, and one special character.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;URL Parsing:&lt;/strong&gt; Extracting slugs or IDs from a browser's address bar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Scrubbing:&lt;/strong&gt; Removing formatting from phone numbers (e.g., changing +254 712-345-678 to 254712345678).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search and Replace:&lt;/strong&gt; Swapping specific words across a whole document using the global /g flag.
### Helpful Methods in JavaScript
To use your patterns, you’ll mostly use these two methods:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;regex.test(string)&lt;/strong&gt;: Returns true or false. Perfect for form validation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;string.match(regex)&lt;/strong&gt;: Returns an array of matches. Great for extracting information from a large block of text.
&amp;gt; &lt;strong&gt;Pro Tip:&lt;/strong&gt; Use tools like &lt;strong&gt;RegEx101&lt;/strong&gt; to test your patterns in real-time before putting them into your code. It provides a "flavor" setting—make sure to select &lt;strong&gt;ECMAScript (JavaScript)&lt;/strong&gt;.
&amp;gt; 
### Conclusion
Regex might feel like a steep climb, but it is a "learn once, use everywhere" skill. Whether you are working on a Go backend or a JavaScript frontend, the logic remains largely the same. Keep practicing by trying to validate other common inputs like phone numbers or postal codes!&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Docker Unlocked: What I Wish I Knew earlier.</title>
      <dc:creator>Juma Evans</dc:creator>
      <pubDate>Wed, 18 Feb 2026 20:20:02 +0000</pubDate>
      <link>https://dev.to/juma_evans_34e389ef539266/docker-unlocked-what-i-wish-i-knew-earlier-143f</link>
      <guid>https://dev.to/juma_evans_34e389ef539266/docker-unlocked-what-i-wish-i-knew-earlier-143f</guid>
      <description>&lt;p&gt;When I first heard about Docker, I thought it was something extremely complex that only senior developers used.&lt;/p&gt;

&lt;p&gt;Until recently, that is. When I finally started learning Docker, I found out how amazing it is, and I want to share what I've learned.&lt;br&gt;
If you're just starting out, this is for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So…&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;1. What Is Docker?&lt;/strong&gt;&lt;br&gt;
Docker is a tool that lets you package your application with everything it needs to run:-dependencies, libraries, system tools, and your code;into something called a &lt;strong&gt;container&lt;/strong&gt;.&lt;br&gt;
&lt;strong&gt;2. What Problem Does Docker Solve?&lt;/strong&gt;&lt;br&gt;
Think of it like this:&lt;br&gt;
"It works on my machine" stops being an excuse.&lt;br&gt;
With Docker, if it works inside the container, it works everywhere. &lt;br&gt;
Before Docker, this is what used to happen:&lt;br&gt;
Developer X runs the application successfully.&lt;br&gt;
Developer Y tries to run it, and it breaks.&lt;/p&gt;

&lt;p&gt;Developer X tells Developer Y: “But it works on my machine!”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt;&lt;br&gt;
Different environments:&lt;/p&gt;

&lt;p&gt;° Different operating systems&lt;br&gt;
° Different versions of NODE or Go or Python&lt;br&gt;
° Different installed dependencies&lt;/p&gt;

&lt;p&gt;Docker solves this by creating a consistent environment that travels with your application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. What Is a Container?&lt;/strong&gt;&lt;br&gt;
A container is like a lightweight, portable box for your application.&lt;br&gt;
But unlike a full virtual machine:&lt;/p&gt;

&lt;p&gt;° It starts fast—usually in seconds&lt;br&gt;
° It uses fewer resources&lt;br&gt;
° It's easy to share and move around&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How It Works:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You define how your application should run in a file called a Dockerfile (a blueprint for your environment).&lt;/li&gt;
&lt;li&gt;Docker uses that file to build an image (a snapshot of your app and everything it needs).&lt;/li&gt;
&lt;li&gt;Then that image runs as a container (the live, running version of your application).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When I first installed Docker, created my Dockerfile, built an image, and it actually worked…&lt;br&gt;
I felt like I unlocked a new level in development 😂.&lt;br&gt;
That was the moment I realized:&lt;br&gt;
This is how real-world applications are deployed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Every Beginner Should Learn Docker&lt;/strong&gt;&lt;br&gt;
Here is why I believe Docker is worth learning early:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It Makes You Think Like a Backend Engineer
You begin to understand:
° Ports and how applications communicate
° Services and how they connect
° Environment configurations
° How production setups differ from local development&lt;/li&gt;
&lt;li&gt;It Improves Your Project Structure
You naturally start organizing your apps better when you know they'll run in containers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;🛠 Things That Confused Me at First&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;To be honest&lt;/em&gt;:&lt;br&gt;
° Images vs. Containers: I couldn't keep them straight. (Think of an image as a recipe and a container as the actual cooked meal.)&lt;br&gt;
° Dockerfile syntax: It looked scary at first glance.&lt;br&gt;
° Ports: Mapping ports from the container to my computer didn't make sense initially.&lt;/p&gt;

&lt;p&gt;But after building just one simple container for a Go app, everything started connecting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Next?&lt;/strong&gt;&lt;br&gt;
Now that I understand the basics, I plan to:&lt;/p&gt;

&lt;p&gt;° Containerize my Go projects&lt;br&gt;
° Learn Docker Compose (for running multiple containers)&lt;br&gt;
° Understand how containers are used in production&lt;/p&gt;

&lt;p&gt;One step at a time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
Imagine you bake a cake 🍰 at home.&lt;br&gt;
You pack:&lt;br&gt;
°The cake&lt;br&gt;
°The ingredients list&lt;br&gt;
°The exact oven settings&lt;br&gt;
°The instructions&lt;/p&gt;

&lt;p&gt;Then you put everything inside one box.&lt;br&gt;
Now, no matter where that box goes, Nairobi, Kisumu, or New York, anyone can open it and get the exact same cake.&lt;br&gt;
That is exactly what Docker does.&lt;/p&gt;

&lt;p&gt;It puts:&lt;br&gt;
. Your app&lt;br&gt;
. The tools it needs&lt;br&gt;
. The correct settings&lt;br&gt;
Inside one “box” called a container.&lt;br&gt;
So instead of saying:&lt;br&gt;
“It works on my machine.”&lt;br&gt;
You can confidently say:&lt;br&gt;
“It works everywhere.”&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
