This will do:
/^(apple|banana)$/
to exclude from captured strings (e.g. $1
,$2
):
(?:apple|banana)
Or, if you use a standalone pattern:
apple|banana
More Related Contents:
- How can I validate an email address using a regular expression?
- Reference – Password Validation
- RegEx for matching UK Postcodes
- Validating IPv4 addresses with regexp
- Regular expression for first and last name
- Validating email addresses using jQuery and regex
- What is a regular expression which will match a valid domain name without a subdomain?
- Decimal or numeric values in regular expression validation
- Is regular expression recognition of an email address hard?
- How to validate phone numbers using regex
- Regular Expression Match to test for a valid year
- HTML5 input pattern search for quote
- US Phone Number Verification
- Regular expression for GB based and only numeric phone number
- Regex for Mobile Number Validation
- Regex validation of email addresses according to RFC5321/RFC5322
- Regex for a valid 32-bit signed integer
- Regular expression [ 1 ( 0 1* 0)* 1 ]* DFA
- subdomain htaccess rediect with query string
- Regex to pick characters outside of pair of quotes
- Disable validation of HTML5 form elements
- Find ‘word’ not followed by a certain character
- Negative matching using grep (match lines that do not contain foo)
- Regular expression for validating names and surnames?
- What regex can match sequences of the same character?
- What does ?! mean?
- Extract substring using regexp in plain bash
- What’s wrong with my lookahead regex in GNU sed?
- Regular expression to remove one parameter from query string
- Swift 3 – How do I extract captured groups in regular expressions?