Reply To: Greps Search Question

#75815
Anonymous
Inactive

(?<=\[).+?(?=\])

(?<=) is a positive lookbehind (it looks but does not include in the find

\[ is an open bracket, you need to escape the open bracket with a backslash

.+ is any character
? is a qualifier for the shortest match, so stop and don’t find more than the shortest match

(?=) is a positive lookahead
\] is a closed bracket

All together, it’s – look for an open bracket but don’t include it, then find any text in it’s shortest string, up to, but don’t include a closed bracket.

This finds all text within a [….]

This article was last modified on June 4, 2015

Comments (0)

Loading comments...