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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:14:15+00:00 2026-06-08T17:14:15+00:00

I am trying to construct a complex query. I have a table, and in

  • 0

I am trying to construct a complex query. I have a table, and in that table, I would like to add an artificial field, match_count, using SELECT *,match_count FROM. That’s not the problem. The problem is this: I have several regular expressions, and I would like to increase the match_count with each regular expressions found. These expressions are to be applied to several fields of the table, like param1 REGEXP "reg1" and param2 REGEXP "reg2", and param1 REGEXP "reg3". Columns can be re-used, as can be the expressions, but the match_count field should correspond to the number of matches.

If possible, it would also be cool if, if a column matches a regular expression several times, the match count were increased not by one, but by the number of these matches.

  • 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-08T17:14:16+00:00Added an answer on June 8, 2026 at 5:14 pm

    You can sum the results of the REGEXP expressions:

    SELECT *,
        param1 REGEXP "reg1" +
        param2 REGEXP "reg2" +
        param1 REGEXP "reg3" AS match_count
    FROM
    

    If possible, it would also be cool if, if a column matches a regular expression several times, the match count were increased not by one, but by the number of these matches.

    I don’t think it’s possible in MySQL. It is however possible in many general purpose languages.

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

Sidebar

Related Questions

Trying to construct a query such that I have multiple statement specifying joins, each
I'm trying to construct a regular expression that would extract the name of the
Very complex query been trying to construct it for few days with more real
I'm trying to construct a complex query. My entities look as follows: @Entity public
I find that when trying to construct complex MySQL joins and groups between many
I'm trying to construct a page layout that will look something like this: In
I have a C++ SOAP client using gSOAP and am trying to construct a
I have been trying to write a constructor function that would make an object
I'm trying to construct a class that would map with this XML structure, but
Am trying to construct a simple update query in my model class Model_DbTable_Account extends

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.