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 8990685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:33:14+00:00 2026-06-15T22:33:14+00:00

I have a list of strings which contain 4 items: Orange Lemon Pepper Tomato

  • 0

I have a list of strings which contain 4 items:

Orange
Lemon
Pepper
Tomato

Also, I have a String str which has a sentence:

Today, I ate a tomato and an orange.

1) How can I check that str has some keywords from list? without considering upper or lower case letters, basically capturing anything that matches?

I tried this but it doesn’t work because it will look for the same words. list.Contains(str)

Also Dim result As String() = list.FindAll(str, Function(s) s.ToLower().Contains(str)) but also didn’t work.

2) What if the word tomato was tomatoes in str, how can I still detect the tomato part and discard the es part?

Any suggestions or ideas ?

  • 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-06-15T22:33:16+00:00Added an answer on June 15, 2026 at 10:33 pm
    var list = new string[] { "Orange", "Lemon", "Pepper", "Tomato" };
    var str = "Today, I ate a tomato and an orange.";
    

    With LINQ and Regular Expressions you can check if string contains any keyword:

    list.Any(keyword => Regex.IsMatch(str, Regex.Escape(keyword), RegexOptions.IgnoreCase));
    

    Or get matched keywords:

    var matched = list.Where(keyword =>
                    Regex.IsMatch(str, Regex.Escape(keyword), RegexOptions.IgnoreCase));
    // "Orange", "Tomato"
    

    BTW this will match both tomatoes and footomato. If you need to match start of word, then search pattern should be changed a little: @"(^|\s)" + keyword

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list which contains some items of type string. List<string> lstOriginal; I
I have the following code which utilises Guava's Files.readLines() method: List<String> strings = Lists.newArrayList();
I have a list which contains some strings like below: List<String> l = new
I have a list of items(i.e Strings) which I need to sort/filter. The end
Example of the problem If I have a list of valid option strings which
I have a simple list of strings, which may be of arbitrary length. I'd
I have a customers List(of String) on which I am trying to find the
I have a string which is basically a list of words delimited by commas.
Quick question, I have the following string which is a coma separated list of
I have a ListView which displays a list of string values. I want to

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.