Code:
(if
(string-match-p "\\(.*\\)/www/sites"
"/var/www/lwt/www/sites/all/modules/bundles/bundles.module")
(match-string-no-properties 1
"/var/www/lwt/www/sites/all/modules/bundles/bundles.module")
"false"
)
Here I expected to get "/var/www/lwt", but I get nil
. What is wrong?
As its docstring tells you:
string-match-p
is a compiled Lisp function in `subr.el'.(string-match-p REGEXP STRING &optional START)
Same as `string-match' except this function does not change the match data.
So you should be using string-match
.