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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:57:42+00:00 2026-05-11T06:57:42+00:00

I have a list of function calls stored in a database, and for some

  • 0

I have a list of function calls stored in a database, and for some function calls, I care about what the arguments of the function call are. I am parsing C source code with my program (which is in C#). I’m trying to find the best way of getting the function calls with the arguments. I read the source code into a string prior to parsing it (so that I am not using the stream reader on the file). I tried using some regex (which is somewhat new to me) to parse the source file, but was retrieving more than just the function call when using a regex string like this: functionCall + ‘.*\\)’; ( I am escaping the opening ( in the function call)

The function calls are stored in the following format in the DB

Function Call ============ some_Call( 

There is a reason they are stored this way, and will not change.

Is there a good way to do this through regex, or would I be better suited to walk through the source code contents?

Let me know if any clarification is needed.

  • 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. 2026-05-11T06:57:42+00:00Added an answer on May 11, 2026 at 6:57 am

    Part of the reason your solution failed is that you probably should have used .*?), instead of greedy matching.

    A complete answer would have to follow at least these:

    Ignore parenthesis in strings and chars (which you can do with a regex, although with escaping it can be a little complicated)

    functionCall('\')', ')') 

    Ignore parentheses in comments (which you can do with a regex)

    functionCall(/*)*/ 1, // ) 2) 

    Don’t match too much (which you can do with a regex)

    functionCall(1) + functionCall(2) + (2 * 3) // Don't match past the first ) 

    but it would also have to ignore balanced parentheses

    functionCall((1+(1))*(2+2)) 

    This last one is something you can’t do with a normal regex, because it involves counting parenthesis, and is generally something that regexs aren’t suited for. However, it appears that .NET has ways to do this.

    (And technically you would have to handle macros, I can imagine a

    #define close_paren ) 

    would ruin your day…)

    That said, you could likely come up with a naive solution (similar to what you had, or what some other poster recommends) and it would work for many cases, especially if you’re working with known inputs.

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

Sidebar

Related Questions

No related questions found

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.