---
title: "Discussion on \"TIL: convert a string into an array of words in JS\" | Hashnode"
description: "Discussion on \"TIL: convert a string into an array of words in JS\". Sometimes it's nice to document the little wins. Today, I learned this useful bit of code to parse a string into an array of words, while removing punctuation.\ntext.replace(/\\p{P}/gu, \"\").split(\" \"))\nTo break this down:\n\ntext: the string to parse\n.re..."
url: "https://hashnode.com/posts/til-convert-a-string-into-an-array-of-words-in-js/629a576c3096cc2656dfbc58"
---

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

Discussion

# [TIL: convert a string into an array of words in JS](https://blog.kellenbaker.com/til-convert-a-string-into-an-array-of-words-in-js?utm_source=hashnode&utm_medium=feed)

Sometimes it's nice to document the little wins. Today, I learned this useful bit of code to parse a string into an array of words, while removing punctuation. text.replace(/\\p{P}/gu, "").split(" ")) To break this down: text: the string to parse .re...

Jun 3, 2022 · 1 min read · blog.kellenbaker.com  
Read the article

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

## Written by

[Kellen](https://hashnode.com/@mkb)

@mkb

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

Fullstack developer, musician, CI/CD enthusiast

## Responses 1

Markdown supported · ⌘↵ to post

[Developer Avocado](https://hashnode.com/@AvocaDEV)

[Jun 4, 2022](https://hashnode.com/posts/til-convert-a-string-into-an-array-of-words-in-js/629a576c3096cc2656dfbc58/comment/629b61d77ab2e32eed5b9211)

Thanks for sharing ! 👏
