---
title: "Discussion on \"Your Word Counter Is Lying to You: How Unicode Breaks Naive Word Splitting\" | Hashnode"
description: "Discussion on \"Your Word Counter Is Lying to You: How Unicode Breaks Naive Word Splitting\". Open any \"how to count words in JavaScript\" tutorial and you will see the same one-liner:\nconst count = text.trim().split(/\\s+/).length;\n\nIt works for \"hello world\". It falls apart the moment real tex"
url: "https://hashnode.com/posts/your-word-counter-is-lying-to-you-how-unicode-breaks-naive-word-splitting/6adc58e65070683322ef7a5d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Your Word Counter Is Lying to You: How Unicode Breaks Naive Word Splitting](https://handynest.hashnode.dev/your-word-counter-is-lying-to-you-how-unicode-breaks-naive-word-splitting?utm_source=hashnode&utm_medium=feed)

Open any "how to count words in JavaScript" tutorial and you will see the same one-liner: const count = text.trim().split(/\\s+/).length; It works for "hello world". It falls apart the moment real tex

Oct 24 · 5 min read · handynest.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#unicode](https://hashnode.com/tag/unicode)
-   [#webdev](https://hashnode.com/tag/webdev)
-   [#tutorial](https://hashnode.com/tag/tutorial)

## Written by

[Muhammad Imran](https://hashnode.com/@muhammadimran)

@muhammadimran

  
[View profile](https://hashnode.com/@muhammadimran)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
