Info

此问题已关闭。 请重新打开它进行编辑或回答。

Regular expression replace problem ?

2 次查看(过去 30 天)
Majed
Majed 2012-11-23
关闭: MATLAB Answer Bot 2021-8-20
Hi every one ,
I need to replace every decimal number by a special tag like <NUM> in a given text
Thanks
  3 个评论
Majed
Majed 2012-11-23
编辑:Walter Roberson 2012-11-23
i GOT THE ANSWER
BUT THE PROBLEM i HAVE IS
HOW TO REPLACE "abc 123BC xyz"
to "abc <DATE> xyz"

回答(1 个)

Majed
Majed 2012-11-23
编辑:Walter Roberson 2012-11-24
i GOT THE ANSWER
s = regexprep(s, '(\d+)BC', '<DATE>');
answer is "abc <DATE> xyz"

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by