Skip to content
Advertisement

Regex, match values inside of curly brackets

Having the next string

{ Hello, testing, hi stack overflow, how is it going }

Match every word inside of curly brackets without the comma.

I tried this:

{(.*)} which take all, commas and brackets included.

{w+} I thought this will work for words but it wont, why?

Updated

Tried this but I got null, why?

JavaScript

Advertisement

Answer

did you try:

first get everything between {} by using

JavaScript

then get all words inside of the resulting string.

JavaScript

Here is an explanation:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement