Vim, Regex, and PHP - Search for PHP Namespace
Negative and positive look-behinds are kind of awkward in Vim's flavor of Regex... so I figured I'd publish this regex that took me longer than it should have to figure out:
/\(namespace\s\)\@<=.*\(;\)\@=
Boom. There you go. Now you have the namespace... and ONLY the namespace in your search highlight. This could be used for some result parsing or what have you, instead of just doing a more basic /namespace\s\(.*\);
.
Hope this helps someone else!
If not, its at least archived for my own reference. :P
Written by Trevor N. Suarez
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#