IfMatchActions

IfMatch options are used in any measure, of any type, to evaluate a Perl Compatible Regular Expression. The regular expression will be evaluated as "true" or "false" based on matching with the string value of the measure, and will execute IfMatchAction or IfNotMatchAction action options, which will contain one or more Bangs or commands.IfMatchオプションは、Perl互換の正規表現を評価するために、あらゆるタイプのあらゆるメジャーで使用されます。正規表現は、メジャーの文字列値との一致に基づいて「true」または「false」として評価され、1つ以上の前髪またはコマンドを含むIfMatchActionまたはIfNotMatchAction アクションオプションを実行します。

There can be multiple sets of match and action options in the measure, by using IfMatch2 / IfMatchAction2 / IfNotMatchAction2 and so on.IfMatch2 / IfMatchAction2 / IfNotMatchAction2などを使用して、メジャーに一致およびアクションオプションのセットが複数ある場合があります。

The full range of PCRE regular expression functionality is supported, so the match can be made on all or part of the measure's string value, can test the order of sub-strings within the string, and can test for both the presence or absence of a sub-string within the string. Logical OR and AND testing can be done in the regular expression, using the | character to support OR and Lookahead assertions (?=..) to support AND.全範囲のPCRE正規表現機能がサポートされているので、メジャーの文字列値の全部または一部で一致を確認でき、文字列内のサブストリングの順序をテストでき、文字列の有無をテストできます。文字列内のサブ文字列。論理ORおよびANDテストは、|ORをサポートする文字とANDをサポートする先読みアサーション (?=..)を使用して、正規表現で実行できます。

Reserved characters in regular expression, which are .^$*+?()[{\| must be escaped with the \ character when used as a literal in the IfMatch option. If using a measure value as a section variable in the IfMatch option, the :EscapeRegExp modifier can be used to properly escape reserved characters in the measure.正規表現内の予約文字。オプションでリテラルとして使用する場合.^$*+?()[{\|は、その\文字をエスケープする必要がありIfMatchます。IfMatchオプションでメジャー値をセクション変数として使用する場合は、:EscapeRegExp修飾子を使用して、メジャー内の予約文字を正しくエスケープすることができます。

Capture groups () should not be used in the regular expression, as nothing is being captured and no indexes are being created. The function is simply used to test if the string measure matches some regular expression pattern, and will either be "true" (IfMatchAction) or "false" (IfNotMatchAction).キャプチャー・グループ()は、何もキャプチャーされず、索引も作成されないため、正規表現では使用しないでください。この関数は、文字列measureが正規表現パターンと一致するかどうかをテストするために使用され、 "true"(IfMatchAction)または "false"(IfNotMatchAction)のいずれかになります。

Optionsオプション

IfMatch, IfMatch2, ..., IfMatchNIfMatchIfMatch2、...、IfMatchN

The regular expression matched with the string value of the measure.メジャーの文字列値と一致する正規表現。

Examples: Measure value is "Red, Green, Blue"例:数値は "赤、緑、青"です。

IfMatch=Red, Green, Blue : trueIfMatch=Red, Green, Blue :本当

IfMatch=.*Green.* : trueIfMatch=.*Green.* :本当

IfMatch=(?i).*green.* : trueIfMatch=(?i).*green.* :本当

IfMatch=^Red.* : trueIfMatch=^Red.* :本当

IfMatch=.*Blue$ : trueIfMatch=.*Blue$ :本当

IfMatch=Red|Blue : trueIfMatch=Red|Blue :本当

IfMatch=(?=Blue)(?=Red) : trueIfMatch=(?=Blue)(?=Red) :本当

IfMatchAction, IfMatchAction2, ..., IfMatchActionNIfMatchActionIfMatchAction2、...、IfMatchActionN

Optional action to be executed when the regular expression in IfMatch results in "true". The action is executed only once when the condition becomes "true", so it needs to become "false" and again "true" to execute again.IfMatchの正規表現が "true"になったときに実行されるオプションのアクション。アクションは、条件が「true」になったときに一度だけ実行されるため、「false」になり、再度実行するには「true」になる必要があります。

IfNotMatchAction, IfNotMatchAction2, ..., IfNotMatchActionNIfNotMatchActionIfNotMatchAction2、...、IfNotMatchActionN

Optional action to be executed when the regular expression in IfMatch results in "false". The action is executed only once when the condition becomes "false", so it needs to become "true" and again "false" to execute again.IfMatchの正規表現が "false"になったときに実行されるオプションのアクション。アクションは、条件が「偽」になったときに一度だけ実行されるので、再度実行するには「真」になり、再び「偽」になる必要があります。

IfMatchMode Default: 0IfMatchMode デフォルト: 0

If set to 1, the evaluation of the match will execute the appropriate actions in IfMatchAction or IfNotMatchAction on every update of the measure.に設定されている場合1、一致の評価はメジャーの更新ごとにIfMatchActionまたはIfNotMatchActionで適切なアクションを実行します。

Note: Care should be taken not to create an infinite loop in the actions. In particular, !Refresh, !Update and !UpdateMeasure #CURRENTSECTION# should generally be avoided when IfMatchMode=1.注:アクションに無限ループを作成しないように注意する必要があります。特に、!Refresh!Updateおよび!UpdateMeasure #CURRENTSECTION#一般たときに避けるべきですIfMatchMode=1

Example

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[MeasureDate]
Measure=Time
Format=%A, %B %#d, %Y
IfMatch=Saturday|Sunday
IfMatchAction=[!SetOption MeterDayofWeek Text "The date is [MeasureDate]#CRLF#It's a weekend"]
IfNotMatchAction=[!SetOption MeterDayofWeek Text "The date is [MeasureDate]#CRLF#It's a weekday"]
IfMatchMode=1

[MeterDayofWeek]
Meter=String
FontSize=13
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1

関連記事

スポンサーリンク

$R() 関数

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る