Navigate back to the homepage

how to remove curly braces from string in javascript?

Infinitbility
JavaScript
January 24th, 2022 · 1 min read
keep affilitate

Hello Friends 👋,

Welcome to Infinitbility.

Today, we are going to learn how to remove curly braces from string in javascript.

To remove curly braces, we will use javascript replace() method and some regex code.

Javascript replace() method also accept regex code to do the operation and we will write regex code to search curly braces global level in the string.

Let’s take an example

1let str = "i'm {infinitbility}, and i provide example of {code snipest}";

Now, we have to remove all curly braces from string.

1let str = "i'm {infinitbility}, and i provide example of {code snipest}";
2
3str = str.replace(/[{}]/g,'');

Output

JavaScript, remove, braces, example
JavaScript remove braces example

Here, i have use regex to remove curly braces of every ocurance in string.

Thanks for reading…

Follow me on Twitter

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

melio affilitate

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide

Tutorials

Categories

More articles from Infinitbility

How to check react native version in CMD?

React Native, check version in CMD example.

January 20th, 2022 · 1 min read

How to remove blank space from an array in javascript?

Javascript, delete space from array example.

January 19th, 2022 · 1 min read
© 2020–2022 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]