Excel VBA RegEx Using * (asterik) + End-Points to Match Entire String -
why following return "data" , not "_data_5252014_"?
dim regex new regexp regex.global = true regex.pattern = "_data_*_" name = "ecmosso_data_12312013_results_tbl" msgbox regex.execute(name)(0).value
i guess documentation indicates matches preceeds *, under impression regular expression yield "_data_12312013_" , not "data". there way accomplish want?
you're matching underscore, preceding — "zero or more" times.
instead, use token .*
( any single character "except newline" ). greedy *
operator shoot end of string, backtrack last underscore want use *?
non-greedy match meaning "zero or more — preferably few possible".
_data_.*?_
Comments
Post a Comment