Possible Duplicate:
Regular Expression to find a string included between two characters, while EXCLUDING the delimiters
I have a function where I have to get text which is enclosed in square brackets but not brackets for example
this is [test] line i [want] text [inside] square [brackets]
from the above line I want words:
test
want
inside
brackets
I am trying with to do this with /\[(.*?)\]/g
but I am not getting satisfied result, I get the words inside brackets but also brackets which are not what I want
I did search for some similar type of question on SO but none of those solution work properly for me here is one what found (?<=\[)[^]]+(?=\])
this works in RegEx coach but not with JavaScript. Here is reference from where I got this
here is what I have done so far: demo
please help.