Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 651345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:09:09+00:00 2026-05-13T22:09:09+00:00

Is a regular expression the correct way of going about this? I have a

  • 0

Is a regular expression the correct way of going about this?

I have a list of strings (Big Ape, Big Bird, Small Bird, Small Ape, Medium Ape, Silver Ape, Blue Ape, Black Ape) if I enter ‘Big’ the regular expression should return (Big Ape, Big Bird), if I enter ‘al’ the the list that is returned is ‘Small Bird, Small Ape). Is this possible, kind of context search with regular expressions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:09:10+00:00Added an answer on May 13, 2026 at 10:09 pm

    This is easy, but RE’s are more powerful than you need for simple substring matching.

    Here is an example in python

    import re   ### regular expression library
    
    possibilities = ['Big Ape', 'Big Bird', 'Small Bird', 'Small Ape',
                     'Medium Ape', 'Silver Ape', 'Blue Ape', 'Black Ape']
    
    def search(list, pattern):
        output = []
        for item in list:
           match = re.search(pattern, item)
           if match:
               output.append(item)
        return output
    

    The output:

    >>> search(possibilities, 'Big')
    ['Big Ape', 'Big Bird']
    
    >>> search(possibilities, 'al')
    ['Small Bird', 'Small Ape']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a JS regular expression to have at-least one alphabet, one number &
Here's my regular expression that I have for this. I'm in Ruby, which —
What is the correct regular expression to use to validate a date like. 2009-10-22
I need to write a regular expression that will be correct for telephone number
Given a html document, what is the most correct and concise regular expression pattern
This regular expression in C# is giving me error in java: <input type=hidden name=GALX
My regular expression needs to be able to find the strings: Visual Studio 2008
I'm trying to find the correct Regular Expression to match all RT scenarios on
I am looking to do a 2-step regular expression look-up in Perl, I have
I have a very basic regular expression that I just can't figure out why

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.