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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:17:25+00:00 2026-05-15T23:17:25+00:00

We have a string input and the following combinations are valid (e.g. sunday ,

  • 0

We have a string input and the following combinations are valid (e.g. sunday, *sunday*, sun*day*, *sun*day, su*nda*y)
If it contains only a single asterisk, then it is a bad input.

So given the above input, how do I check to see if the string contains multiple asterisks.

  • 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-15T23:17:25+00:00Added an answer on May 15, 2026 at 11:17 pm

    You could use String.matches with a regular expression:

    "^.*(?:\\*.*){2}$"
    

    If you want exactly two asterisks:

    "^[^*]*(?:\\*[^*]*){2}$"
    

    Though for this task it might be simpler just to iterate over the string and count the asterisks.

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

Sidebar

Related Questions

Hi I have the following date as String format. Input 2010-04-20 05:34:58.0 Output I
A have the following input string: string input = Ta005000000000000000000Tb001700000000000000000Sa005000000000000000000 + Sb002500000000000000000F 00000000000000000I 00000000000000000N
I have an input string in the following format String input = 00IG356001110002005064007000000; Characters
I have an input string in the following format: 12.34 When I call this
I have the following code: string input = ç; string normalized = input.Normalize(NormalizationForm.FormD); char[]
I have an input string that's generated as in following example: string.Format(Document {0}, was
Why would you use the following? Microsoft.VisualStudio.TestTools.UnitTesting.Assert.ReplaceNullChars(string input) I have searched but can't find
Suppose you have the following string: white sand, tall waves, warm sun It's easy
consider following scenario input string = WIPR.NS i have to replace this with WIPR2.NS
How can I achieve the following using Regex/c# replace? Input string I have :

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.