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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:57:30+00:00 2026-06-06T03:57:30+00:00

I have a string which varies everytime it is input as it is a

  • 0

I have a string which varies everytime it is input as it is a search query, an example of this may be Z00044XLE1311, however I wish to do that the same product can be returned if the customer removes all the 0’s (there is always zeros after the first few letters) however I don’t seem to be able to do this, I want to essentially search for Z*44XLE1311 instead.

I would prefer to do this using Regex as this is how my current search feature is done. I am aware that I should use substitution but I am unsure how to use this properly for this problem.

My current code is,

                if (!string.IsNullOrEmpty(base.RemoveCharacters))
                {
                    var regex = new Regex(string.Format("[{0}]+", base.RemoveCharacters));
                    text = regex.Replace(text, string.Empty);
                }

                if (Regex.IsMatch(text, "^[a-z]+00+", RegexOptions.IgnoreCase))
                {
                    text = new Regex("0{1,}", RegexOptions.IgnoreCase).Replace(text, "00*", 1);
                }
                else
                {
                    if (Regex.IsMatch(text, "^[a-z]+", RegexOptions.IgnoreCase))
                    {
                        text = new Regex("[A-Z]{1,}", RegexOptions.IgnoreCase).Replace(text, "[A-Z]*", 1);
                    }
                    URL = WebUtilities.AddToQueryString(URL, box.Key, Page.Server.UrlEncode(text));
            }
        }
  • 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-06T03:57:32+00:00Added an answer on June 6, 2026 at 3:57 am

    I actually have this now working, I have used:

                    text = Regex.Replace(text, "^([a-z]+)0*([1-9][0-9]*)", @"$1 0\* $2", RegexOptions.IgnoreCase);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple request (hopefully) here. I have a string which whilst it varies in length,
I have string which contains either A ,B, C, or D (example A123 or
I have a string which I store book pages. It's something like this: ///0///
I have a string which contains 3 elements: a 3 digit code (example: SIN,
Here I have string like this 1322485986.672901000 , data type is string which represents
I have a string which is like this: this is "a test" I'm trying
I have a string which is like this 187878 - my text comment -
i am making application in c#. In that implication i have string which contain
I have a string which has numbers. I have to parse this string and
I have html string which i want to load in web view but i

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.