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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:17:55+00:00 2026-05-27T17:17:55+00:00

I want to take an expression like (123456789..value > 2000) && (987654321.Value < 12)

  • 0

I want to take an expression like

(123456789..value > 2000) && (987654321.Value < 12)

extract the 123456789 and 987654321 (could be anything here)

and replace it with

ClassName.GetInfo("%s").GetValue() (as an example)

putting the 2 values in the place of the %s…

to be a resulting

(ClassName.GetInfo("123456789").GetValue() > 2000) && (ClassName.GetInfo("987654321").GetValue() < 12)

Can anyone give me a clue as to how to accomplish this?

  • 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-27T17:17:56+00:00Added an answer on May 27, 2026 at 5:17 pm

    A rather oversimplified example, but this should work.

    Note that the following will only allow alpha-numeric or ‘-‘ or ‘_’ in the place you claim (could be anything here). This is by nessesity if you intend to be able to recognize it with any form of parser regex or otherwise. You need to either limit the characters that can be used as an identifier, or you need to delineate them and allow for escaping the delimitation characters.

    private static void Main()
    {
        Regex pattern = new Regex(@"(?<Name>[\w\-_]+)\.+(?<Value>[\w\-_]+)");
        string sample = @"(123456789..value > 2000) && (987654321.Value < 12)";
    
        string result = pattern.Replace(sample,
                                        m =>
                                        String.Format(
                                            "ClassName.GetInfo(\"{0}\").Get{1}{2}()",
                                            m.Groups["Name"].Value,
                                            Char.ToUpper(m.Groups["Value"].Value[0]),
                                            m.Groups["Value"].Value.Substring(1))
            );
        Console.WriteLine(result);
    }
    

    The program outputs:

    (ClassName.GetInfo(“123456789”).GetValue() > 2000) && (ClassName.GetInfo(“987654321”).GetValue() < 12)

    There are two other rather odd behaviors in your example that are addressed above. The first is the use of multiple delimiters ‘..’ in your example “(123456789..value”. This seems like a possible mistake, just remove the ‘+’ from this part of the expression “).+(“.

    The second oddity is that your example just auto-magically corrects the character-case of the first property from “value” to “Value”. Although I mimic this magical behavior by ensuring the first character is upper-case this is not a great solution. A better answer would be to use a case-insensitive dictionary and lookup the proper case.

    Hopefully that will get you started, but I have to be honest and say you have a VERY long road ahead of you. Parsing an expression language is never a trivial thing and should generally be avoided. If this is for internal use just make them type in the full version. If this is for external use… well, I would re-think you’re objective. Perhaps building a graphical expression tree like SQL’s QBE would be a better expenditure of your time and energy.

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

Sidebar

Related Questions

I want to take an expression in tcl and convert its _ to <
I want to take a math expression that takes variables and print (assign to
I have an Expression<Func<T,DateTime>> I want to take the DateTime part of the expression
I want to have a class property that allow for an expression to take
I want to take string between , but the regular expression matches too long.
I have a Java pattern I would like to match. I want to take
I want to take a class, loop through it's properties, get the property value,
I want to be able to take a URL like: http://www.example.com/valOne/valTwo/valThree/valFour/valFive and convert it
i want to create query like this using lambda expression in ObjectQuery SELECT *
Every once in a while I want to replace all instances of values like:

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.