Using Pattern Trigger (Regex) in Webform Conditional Logic in Drupal 8
✅ Quick Answer: Use ^(Value1|Value2|Value3)$ in Pattern trigger to check for multiple values.
When you need to create survey style forms in Drupal 8 Webform is the clear winner. It's powerful enough to create all sorts of forms and you can even give it to your editor so they can create their own, after a little training, of course.
One part of Webform which I like is the ability to define conditional logic. For example, you can show or hide a text field based off a value from another element. You can also make an element conditionally required. It's a very useful part of Webform, and you do all of this through a UI, no custom code.
Defining simple conditional logic, check if element value has a single value, is pretty straightforward. But when you have to deal with multiple values, this is where things get tricky.
✅ Read full tutorial: https://www.webwash.net/?p=8958
1. Create elements (01:25)
2. Add conditional logic to elements (03:14)
3. Add Pattern trigger (05:52)
4. Using Regex101 (07:51)