(?<=\[)[^\]]*(?=\])
which is matching text:
[11/Sep/2016:21:58:55 +0000]
it works fine in sublime while testing, but when I do
str.match(/(?<=\[)[^\]]*(?=\])/)
Ive got error: SyntaxError: Invalid regular expression
what Im doing wrong ?
str.match(/\[([^\]]*)\]/)and access the first index if you need one match only. Use/\[([^\]]*)\]/gwithRegExp#execand loop through all the matches to get all the values./\[([^\]]*)(?=\])/and use captured group #1