Substitute 代替
Substitute
replaces some or all of a string value returned by a measure with another string.Substitute
メジャーから返された文字列値の一部または全部を別の文字列に置き換えます。
Optionsオプション
Substitute
-
A list of comma delimited
"pattern":"replacement"
pairs. All occurrences ofpattern
in the measure string value are replaced withreplacement
. For example,"This":"That"
substitutes all occurrences of This with That.コンマ区切りの"pattern":"replacement"
ペアのリスト。すべての出現箇所pattern
で測定文字列値が置き換えられますreplacement
。たとえば"This":"That"
、Thisのすべての出現箇所をThatに置き換えます。If multiple
"pattern":"replacement"
pairs are specified, each substitution is attempted in the specified order. For example,"This":"That","Here":"There"
first replaces all occurrences of This with That and then replaces all occurrences of Here with There.複数の"pattern":"replacement"
ペアが指定されている場合、各置換は指定された順序で試行されます。たとえば、"This":"That","Here":"There"
最初にThisのすべての出現箇所をThatに置換し、次にHereのすべての出現箇所をThereに置換します。Each of the
"pattern":"replacement"
pairs are a separate action, and act on the results of the previous substitute pairs. For example, with"1":"One","10":"Ten"
, all occurrences of 1 are replaced with One, but occurrences of 10 will not be replaced with Ten, because the first substitution already changed all 1 characters to One. For the desired behavior, the order can be reversed as"10":"Ten","1":"One"
.各"pattern":"replacement"
ペアは別々のアクションであり、前の代替ペアの結果に基づいて動作します。たとえば、with"1":"One","10":"Ten"
、1の出現はすべてOneに置き換えられますが、10の出現はTenには置き換えられません。これは、最初の置換によってすでに1文字すべてがOneに変更されているためです。望ましい動作のために、順序は次のように逆にすることができます"10":"Ten","1":"One"
。Instead of
"pattern":"replacement"
, single quotes can be used either around the pattern or the replacement. (i.e.'pattern':"replacement"
or"pattern":'replacement'
, but not'pattern':'replacement'
) This can be useful when either the pattern or the replacement contains double quotes. For example,'"':"double quote"
replaces all occurrences of " with double quote.代わりに"pattern":"replacement"
、単一引用符を使用することができますいずれかのパターンまたは交換を中心に。(すなわち'pattern':"replacement"
か"pattern":'replacement'
ではなく'pattern':'replacement'
、パターンまたは交換のどちらかが二重引用符が含まれている場合)に便利です。たとえば'"':"double quote"
、"のすべての出現箇所を二重引用符で置き換えます。 RegExpSubstitute
Default:0
RegExpSubstitute
デフォルト:0
-
If set to
1
, Perl compatible regular expressions can be used in thepattern
part ofSubstitute
pairs.に設定すると1
、Perl互換の正規表現pattern
をSubstitute
ペアの一部に使用できます。If captures are used in the pattern, (e.g.
(.+)
) they can be referenced in thereplacement
part using\1
, (first capture)\2
, (second capture) etc. The entire match can also be referenced with%%BODY%%
.キャプチャがパターンで使用されている場合、(例えば(.+)
)それらは(最初のキャプチャ)、(2番目のキャプチャ)などreplacement
を使用してパート内で参照できます。全体のマッチもで参照できます。\1
\2
%%BODY%%
Note: With RegExpSubstitute, a (capture) may not return an empty string. Care should be taken when using
*
(zero or more) quantifiers or(?(?=
(If/Then) lookahead tests, as a capture must either cause the entire regular expression to "fail", or return a value of some kind.注: RegExpSubstituteでは、(capture)は空の文字列を返さない可能性があります。*
(ゼロ以上の)数量詞や(?(?=
(If / Then)先読みテストを使用する場合は、正規表現全体を「失敗」させるか、何らかの値を返す必要があるため、注意が必要です。
Examples例
Normal substitution:通常の代入:
[MeasureYear] |
Regular expression substitution:正規表現の置き換え
[MeasureEx1] |
関連記事
スポンサーリンク