フィルターのクリア

strrep with replacing precise word and no ' ' explicit in code

3 ビュー (過去 30 日間)
Dominique Joubert
Dominique Joubert 2018 年 9 月 19 日
コメント済み: Walter Roberson 2018 年 9 月 19 日
i have an array in a loop:
use{i,1}=strrep(use{i,1},statename{j,1},xx{1,j})
the idea is to find precise statenames and repacle them with xx
but its doing parts.
how do i use the lookbefoe and after idea here, with no ' 'in the code?
DJ

採用された回答

Walter Roberson
Walter Roberson 2018 年 9 月 19 日
Do not use strrep for this: use regexprep with lookaround operators.
  2 件のコメント
Dominique Joubert
Dominique Joubert 2018 年 9 月 19 日
編集済み: Stephen23 2018 年 9 月 19 日
use{i,1}=regexprep(use{i,1},['(?<=[^a-zA-Z,0-9])',statename{j},'(?=[^a-zA-Z,0-9])'],xx{1,j});
Walter Roberson
Walter Roberson 2018 年 9 月 19 日
Are you sure comma to be part of the list? Those are literal comma not range separators.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by