I want a regex to extract a value from a string but can´t make it work :( regex is hard!
const myString = "the user id is: [user]10[/user]"
this is my regex
(?:[user])([\s\S]*)(?:[\/user])
but I´m not getting a match
I want a regex to extract a value from a string but can´t make it work :( regex is hard!
const myString = "the user id is: [user]10[/user]"
this is my regex
(?:[user])([\s\S]*)(?:[\/user])
but I´m not getting a match
Adding matching square brackets literally by adding \
before them will allow obtaining the match id
value, like following
(?:\[user\])([\s\S]*)(?:\[\/user\])