Hi i am new to programming and i would like to find if a particular pattern exists in a string.
I have a string "i am [1234@some data] some data given to [223@123some data]"
I want to check if the string contains pattern like [1234@some data] or [223@123some data] is present. So it includes square-bracket followed by one or more digits followed by one @ character followed by zero or more digits followed by one or more alphabets followed by space and one or more alphabets.
What i have tried?
const string = "i am [1234@some data] some data given to [223@123some data]"
const pattern_present = string.match((/^\d+\@+\w+$/)
This doesnt seem to work. Could someone help me with this

^and$? Use\[and]instead. Use/\[(\d+@[\w\s]+)]/g. You may as well use/\[([^\][]*)]/gto get all strings inside square brackets.