How to pass 'or' condition using regex?

by elise_daugherty , in category: Third Party Scripts , 6 months ago

How to pass 'or' condition using regex?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by daisha , 6 months ago

@elise_daugherty 

To pass an 'or' condition in a regular expression, you can use the pipe symbol | which acts as the OR operator:


For example, if you want to match either the word "apple" or "orange" in a string, you can use the following regex pattern:


apple|orange


This pattern will match either "apple" or "orange" in the input text.

Related Threads:

How to pass a count as if condition on oracle?
How to do "and" condition in regex angular?
How to backreference group when using or in regex?
How to replace a substring with a regex pattern using regex in python?
How to pass credentials to iframe using javascript?
How to pass product description to paypal using woocommerce?