javascript - escaping metachar in javascripot regex -
i have fragment of string looking begins , ends dot . char.
i trying parse in javascript with:
var regex = new regexp('\\.([^\\.]+)\\.', ''); var ar = s.match(regex);
but doesn't work. doing wrong? way, there more regex, think part not working, other parts simple.
you can strip 1 level of escaping using regular expression literal syntax:
var regex = /\.([^.]+)\./;
additionally that, inside […]
.
not have special meaning outside.
Comments
Post a Comment