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

  • Home
  • SEARCH
  • 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 8793515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:07:55+00:00 2026-06-13T23:07:55+00:00

I have a lot of source codes with SQL queries like below: c_query :=

  • 0

I have a lot of source codes with SQL queries like below:

c_query := "SELECT * FROM TABLE WHERE FIELD_NAME_ONE[2] = 'AB' AND FIELD_NAME_TWO[1,8] = 'ABCDEFGH'"

I would like to match these: FIELD_NAME_ONE[2] and FIELD_NAME_TWO[1,8] and these patterns must be found between double quotes (").

Edit

c_query := “SELECT * FROM TABLE WHERE FIELD_NAME_ONE[2] = ‘AB’ AND FIELD_NAME_TWO[1,8] = ‘ABCDEFGH’ AND TESTE[9] = ‘XXXXXXXXX’ AND FOO = ‘” + is_an_array[2] + “‘”

It shouldn´t match is_an_array[2] because is not inside the double quotes.

  • 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-13T23:07:56+00:00Added an answer on June 13, 2026 at 11:07 pm

    I’m assuming you want to be able to match more than just those two specific fields, otherwise you wouldn’t have gone to the trouble of applying regular expressions:

    var tokens = Regex.Matches(sql, "\"([^\"]+)\"");
    
    foreach (Match token in tokens) {
        string str = token.Groups[1].Value;
    
        var fields = Regex.Matches(str, @"(\w+\[\d+(,\d+)*\])");
    
        foreach (Match field in fields)
            Console.WriteLine(field.Value);
    }
    

    This will find any sequence of letters, numbers and underscores followed by square brackets, with 1 or more comma-separated numbers.

    If you only want to match a sequence of letters and underscores before the square brackets, ammend the pattern to:

    @"([a-zA-Z_]+\[\d+(,\d+)*\])"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello i have tryed a lot of source codes for this but i have
I have to edit a lot of source codes similar to each other. random
I have a lot of classes on my project, my Source Editor displays the
I have lot of code in my Tornado app which looks like this: @tornado.web.asynchronous
I'm using MVC3 with C# code. I have a table in my SQL Server
I know there have been a lot of questions about sql query performance improvement,
I've scored the internet for sources and have found a lot of useful information,
I have lot of products with custom options, now I have requirement to update
We have lot of object with this kind of design : Interface and several
I have a requirement to use date picker in my applicaiton. I have lot

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.