<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Regex on JsonKit Blog</title>
    <link>https://jsokit.com/blog/tags/regex/</link>
    <description>Recent content in Regex on JsonKit Blog</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>© 2025 JsonKit</copyright>
    <lastBuildDate>Tue, 12 May 2026 15:16:32 +0000</lastBuildDate>
    <atom:link href="https://jsokit.com/blog/tags/regex/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Word Counter: Unicode Handling and Regex Edge Cases in Mixed Chinese-English Text</title>
      <link>https://jsokit.com/blog/posts/word-counter-unicode-handling-and-regex-edge-cases-in-mixed-chinese-english-text/</link>
      <pubDate>Tue, 12 May 2026 15:16:32 +0000</pubDate>
      <guid>https://jsokit.com/blog/posts/word-counter-unicode-handling-and-regex-edge-cases-in-mixed-chinese-english-text/</guid>
      <description>Word Counter: Unicode Handling and Regex Edge Cases in Mixed Chinese-English Text Writing articles, tweets, documentation—you always need to count words. Many word counters exist, but when mixing Chinese and English, the results are often wrong. The culprit? Improper Unicode character handling and regex edge cases.&#xA;The Core Logic of Word Counting 1. Character Count Seems simple—just text.length, right? Not quite.&#xA;const text = &amp;#34;Hello 世界&amp;#34; console.log(text.length) // 8, correct But here&amp;rsquo;s the catch—Emoji and special characters:</description>
    </item>
    <item>
      <title>From Regex to Unicode: Building an Accurate Text Statistics Tool</title>
      <link>https://jsokit.com/blog/posts/from-regex-to-unicode-building-an-accurate-text-statistics-tool/</link>
      <pubDate>Thu, 07 May 2026 17:42:01 +0000</pubDate>
      <guid>https://jsokit.com/blog/posts/from-regex-to-unicode-building-an-accurate-text-statistics-tool/</guid>
      <description>From Regex to Unicode: Building an Accurate Text Statistics Tool Recently, while writing technical documentation, I needed to count words. I tried several online tools and found inconsistent handling of Chinese and English text—some counted Chinese by characters, others by &amp;ldquo;words.&amp;rdquo; I decided to implement my own and dive into the technical details behind text statistics.&#xA;Core Metrics for Text Statistics A complete text statistics tool needs at least these metrics:</description>
    </item>
    <item>
      <title>Building a Text Replace Tool: Regex and String Processing</title>
      <link>https://jsokit.com/blog/posts/building-a-text-replace-tool-regex-and-string-processing/</link>
      <pubDate>Thu, 07 May 2026 14:22:41 +0000</pubDate>
      <guid>https://jsokit.com/blog/posts/building-a-text-replace-tool-regex-and-string-processing/</guid>
      <description>Building a Text Replace Tool: Regex and String Processing Recently, I needed to implement a batch replace feature supporting both plain text and regex modes. Seemed simple, but I ran into some interesting gotchas. Here&amp;rsquo;s what I learned.&#xA;Core Requirements A text replace tool typically needs:&#xA;Plain text replace: Direct string search and replace Regex replace: Pattern matching with regular expressions Case sensitivity: Respect or ignore case Replace all vs. first: Replace all matches or just the first one The Plain Text Trap The simplest approach is String.</description>
    </item>
    <item>
      <title>SVG Optimizer Implementation: From Regex to Performance</title>
      <link>https://jsokit.com/blog/posts/svg-optimizer-implementation-from-regex-to-performance/</link>
      <pubDate>Mon, 04 May 2026 11:34:21 +0000</pubDate>
      <guid>https://jsokit.com/blog/posts/svg-optimizer-implementation-from-regex-to-performance/</guid>
      <description>SVG Optimizer Implementation: From Regex to Performance Working on an icon library project, I noticed exported SVG files were often 50KB+. After optimization, they shrank by 60%. But manually uploading and downloading files every time was tedious. So I built my own SVG optimizer. Here&amp;rsquo;s how it works.&#xA;Why Are SVG Files So Large? A typical unoptimized SVG:&#xA;&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-8&amp;#34;?&amp;gt; &amp;lt;!DOCTYPE svg PUBLIC &amp;#34;-//W3C//DTD SVG 1.1//EN&amp;#34; &amp;#34;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&amp;#34;&amp;gt; &amp;lt;svg xmlns=&amp;#34;http://www.w3.org/2000/svg&amp;#34; viewBox=&amp;#34;0 0 24 24&amp;#34; width=&amp;#34;24&amp;#34; height=&amp;#34;24&amp;#34;&amp;gt; &amp;lt;!</description>
    </item>
    <item>
      <title>String Escape Implementation: From Regex Replacement to Unicode Handling</title>
      <link>https://jsokit.com/blog/posts/string-escape-implementation-from-regex-replacement-to-unicode-handling/</link>
      <pubDate>Sun, 03 May 2026 17:58:01 +0000</pubDate>
      <guid>https://jsokit.com/blog/posts/string-escape-implementation-from-regex-replacement-to-unicode-handling/</guid>
      <description>String Escape Implementation: From Regex Replacement to Unicode Handling Dealing with user input strings often causes problems when special characters break JSON parsing. Newlines, quotes, backslashes - they all need proper handling. So I built a string escape tool and here&amp;rsquo;s what I learned.&#xA;The Essence of Escaping Escaping means converting special characters into escape sequences. For example, the newline character \n (ASCII 10) becomes two characters: \ and n.</description>
    </item>
    <item>
      <title>SQL Formatter: From Regex to AST Parser Implementation</title>
      <link>https://jsokit.com/blog/posts/sql-formatter-from-regex-to-ast-parser-implementation/</link>
      <pubDate>Sun, 03 May 2026 15:58:01 +0000</pubDate>
      <guid>https://jsokit.com/blog/posts/sql-formatter-from-regex-to-ast-parser-implementation/</guid>
      <description>SQL Formatter: From Regex to AST Parser Implementation Recently during a code review, I came across a SQL statement compressed into a single line - hundreds of characters strung together, making it painful to read. I looked for an online tool to format it, but the output style didn&amp;rsquo;t match our team&amp;rsquo;s conventions. I decided to implement my own and document the approach.&#xA;Why SQL Formatting is Hard SQL formatting is much more complex than JSON formatting.</description>
    </item>
    <item>
      <title>Building a Regex Tester: Real-time Highlighting and Performance Optimization</title>
      <link>https://jsokit.com/blog/posts/building-a-regex-tester-real-time-highlighting-and-performance-optimization/</link>
      <pubDate>Tue, 28 Apr 2026 15:26:37 +0000</pubDate>
      <guid>https://jsokit.com/blog/posts/building-a-regex-tester-real-time-highlighting-and-performance-optimization/</guid>
      <description>Building a Regex Tester: Real-time Highlighting and Performance Optimization I was working on form validation recently, dealing with various regular expressions. Testing each regex change required a page refresh - too tedious. So I built my own regex tester. Here&amp;rsquo;s how it works.&#xA;How Regex Engines Work JavaScript uses a backtracking regex engine. Think of it as &amp;ldquo;trial and error&amp;rdquo;:&#xA;const regex = /a+b/ const text = &amp;#39;aaab&amp;#39; // Engine execution: // 1.</description>
    </item>
    <item>
      <title>Building a Visual Regex Generator: From Zero to Match</title>
      <link>https://jsokit.com/blog/posts/building-a-visual-regex-generator-from-zero-to-match/</link>
      <pubDate>Tue, 28 Apr 2026 14:26:37 +0000</pubDate>
      <guid>https://jsokit.com/blog/posts/building-a-visual-regex-generator-from-zero-to-match/</guid>
      <description>Building a Visual Regex Generator: From Zero to Match Regular expressions are powerful but notoriously hard to remember. Even experienced developers need to look up syntax for email validation or IP matching. I built a Regex Generator to make this easier. Here&amp;rsquo;s how it works.&#xA;The Problem with Regex Cryptic syntax: \d, \w, \s are manageable, but (?=...), (?:...), (?!) are confusing Hard to debug: One wrong character and nothing matches — no clear error message No visualization: A long regex string is just a wall of symbols The generator aims to solve these with clickable buttons and instant visual feedback.</description>
    </item>
    <item>
      <title>Regex Explainer: Building a Parser from String to Visual Breakdown</title>
      <link>https://jsokit.com/blog/posts/regex-explainer-building-a-parser-from-string-to-visual-breakdown/</link>
      <pubDate>Mon, 27 Apr 2026 14:51:49 +0000</pubDate>
      <guid>https://jsokit.com/blog/posts/regex-explainer-building-a-parser-from-string-to-visual-breakdown/</guid>
      <description>Regex Explainer: Building a Parser from String to Visual Breakdown Published: April 29, 2026, 22:40&#xA;Ever stared at a complex regular expression for five minutes, completely lost? Or inherited someone else&amp;rsquo;s code with a &amp;ldquo;cryptic&amp;rdquo; regex that makes you question your career choices?&#xA;Last week, I was building a form validation feature and needed to understand this email validation regex: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$. After staring blankly for five minutes, I thought: why not build a tool that &amp;ldquo;translates&amp;rdquo; regex into human-readable explanations?</description>
    </item>
    <item>
      <title>Regex Cheatsheet: From Syntax Classification to Search Filtering</title>
      <link>https://jsokit.com/blog/posts/regex-cheatsheet-from-syntax-classification-to-search-filtering/</link>
      <pubDate>Mon, 27 Apr 2026 09:16:18 +0000</pubDate>
      <guid>https://jsokit.com/blog/posts/regex-cheatsheet-from-syntax-classification-to-search-filtering/</guid>
      <description>Regex Cheatsheet: From Syntax Classification to Search Filtering Regular expressions are essential for developers, but the syntax is complex and hard to memorize. A well-designed regex cheatsheet helps you find the syntax you need instantly. This article shares the implementation of JsonKit Regex Cheatsheet, from syntax classification to real-time search filtering.&#xA;Why You Need a Regex Cheatsheet Regex has hundreds of metacharacters, quantifiers, and assertions. It&amp;rsquo;s hard to remember them all.</description>
    </item>
  </channel>
</rss>
