Getting content between curly braces in JavaScript with regex

后端 未结 5 1243
無奈伤痛
無奈伤痛 2020-12-09 12:44

I am trying to get content between curly braces with JavaScript. I found this thread: Regex to get string between curly braces "{I want what's between the curly bra

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 13:12

    Try this

    /[^{\}]+(?=})/g
    

    for example

    Welcome to RegExr v2.1 by {gskinner.com}, {ssd.sd} hosted by Media Temple!

    it will return 'gskinner.com', 'ssd.sd'

提交回复
热议问题