パターン マッチングとワイルドカード
カードの名前や説明のテキストを利用して何かを実行しようとしたことはありますか?たとえば、カードが特定のテキストまたは番号に一致したときに、リスト間でカードを移動したり、特定のボード メンバーにカードを割り当てたりするといったことです。自動化は、このようなタスクを実行するパターンとワイルドカードに対応しています。
自動化トリガーでワイルドカードを使用する
自動化において、ワイルドカードは、カード名または説明の任意のテキストに一致する特別なシーケンスです。
Automation では、次の複数種類のワイルドカードに対応しています。
{*}
: このワイルドカードは、空白を含むすべてのテキストを表します。通常、カード名または説明の最後にあるテキストを照合するために使用されます。{* }
: このワイルドカードは、空白スペースまたはテキストの終わりまでのテキストを表します。通常、カード名または説明の最初/途中のテキストを照合するために使用されます。このワイルドカードを使用する場合は、アスタリスクと閉じ括弧の間に必ず空白を入れるようにします。{?}
: このワイルドカードは、テキストの最小量を表します。
The pattern is the matched text. Patterns can get very complex, with multiple wildcards in one pattern.
Automation のパターンとワイルドカードは、トリガー条件でもっとも頻繁に使用されます。これは、特定の機能のカードに対してのみ発動されるようにトリガーに適用される句です。
例 (トリガー条件とパターンを含む自動化)
when a card containing "urgent" is moved to list "Assigned tasks", copy the card to "My urgent tasks" on board "My main board" and link the cards together
この自動化では、句「containing "urgent"」がトリガー条件で、「urgent」がパターンです。
例 (トリガー条件、パターン、ワイルドカードを含む自動化)
When a card with a name ending with "invoice #{*}" is added to "Inbox", add the "Invoice" label to the card and post comment "@board Invoice number {wildcard1} is in this card!"
This automation also includes the {*}
wildcard that will match any text in the card name, including blank spaces. For instance, the automation will trigger for a card named "Attached invoice #0001". When the automation is executed, it will post a comment "@board Invoice number 0001 has arrived!"
トリガー条件が満たされるには、カード名または説明が指定されたパターンと一致する必要があります。たとえば、パターンが「invoice - {*}」の場合は、名前または説明に「invoice -」を含むカードのみが一致します。
また、{wildcard1}
変数にもご注目ください。この変数は条件パターンにある最初の (そしてこの例では唯一の) ワイルドカードの値を取得します。この例では、値 0001 を取得します。
Note: You can also use additional wildcard variables instead of the default ones ({wildcard1}
, {wildcard2}
, and others) to match against a particular user in automations with certain triggers.
例 (パターンとワイルド カード変数)
テキストが Monday - Tuesday - Wednesday
で、パターンが {*} - {*}
の場合
{wildcard1}
はMonday - Tuesday
になります。{wildcard2}
はWednesday
になります。
この例の「月曜日」を表すために、{?}
ワイルドカードを使用できます。たとえば、上記と同じテキストと {?} - {*}
パターンを利用します。
{wildcard1}
はMonday
になります。{wildcard2}
はTuesday - Wednesday
になります。
より複雑な例
when the name of a card contains "HOT {* } in Automation: {*}", send an email notification to "user@gmail.com" with subject "A bug has been detected!" and message "Ticket: {wildcard1}\n\nIssue: {wildcard2}"
この例では、「HOT 54836 in Automation: Slack notifications aren't working」という名前のカードがボードに追加されると、Automation は次のメールを user@gmail.com に送信します。
自動化の他の部分でワイルドカードを使用する
ワイルドカードによって、カードの名前や説明のテキストだけでなく、ほとんどすべての Trello 要素の名前を表せます。たとえば、メンバー、チェックリスト、リスト、ボード情報にワイルドカードを追加できます。
例:
when a card is moved to list "Week {*}" by anyone, post comment "Scheduled for week {wildcard1} on {date} by {username}."
This automation will trigger for any list which name starts with "Week". Check more information on this video “Automation: Adding a wildcard to an automation“
フィールドに基づいたワイルドカード参照
Automation では、自動化のさまざまな部分で定義されているワイルドカードを、それらが一致したフィールドごとに参照できます。
たとえば、when a checklist item starting with "{*} - {*}" is checked in a card named "{*} for project {*}/{*}" in list "To Do {*}"
のような自動化では、自動化のさまざまな部分に複数のワイルドカードが含まれています。
これらは次のように参照できます。
カード名:
{cardnamewildcard1}
、{cardnamewildcard2}
、etc...チェックリスト アイテム名:
{itemwildcard1}
、{itemwildcard2}
などリスト名:
{listwildcard1}
、{listwildcard2}
、etc...
その他のフィールド
これらのフィールドはすべて上記の3つの例と同じパターンに従い、参照すべき一致(複数ある場合)を示す接尾辞が付きます。
フィールド | ワイルドカード |
チェックリスト名 |
|
カードの説明 |
|
コメント |
|
ラベル名 |
|
添付ファイル名 |
|
この内容はお役に立ちましたか?