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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -