regex - Look-ahead and look-behind assertions with regexprep -
the following works expected perl
's s///g
string replacement operator:
db<18> $s = 'camelcasetext.ext' db<19> $s =~ s/\w|(?<=[^\wa-z_])(?=[a-z])/\$/g; print $s camel$case$text$ext
...but fails in matlab:
>> regexprep('camelcasetext.ext', '\w|(?<=[^\wa-z_])(?=[a-z])', '$') ans = camelcasetext$ext
how can 1 achieve effect illustrated perl
example using matlab?
i think need specify emptymatch
option. according the docs, ignores zero-length matches default.
>> regexprep('camelcasetext.ext', '\w|(?<=[^\wa-z_])(?=[a-z])', '$', 'emptymatch')
Comments
Post a Comment