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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:22:18+00:00 2026-05-31T04:22:18+00:00

I am new to regular expressions. I am looking for something that can help

  • 0

I am new to regular expressions. I am looking for something that can help me do a find and replace throughout our entire code tree with any function that creates a file descriptor.

For example, I need to change socket(PF_LOCAL,SOCK_STREAM, 0) to socket(PF_LOCAL,SOCK_STREAM | SOCK_CLOEXEC, 0)

In each case I am appending to the end of the second argument, but I do not know how long the current second argument is going to be or what text it will contain. I am thinking the best way to do it is to find the second comma and replace that with my string (" | SOCK_CLOEXEC,")

If someone could give me and example of this it would be extremely helpful. Thanks

  • 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-31T04:22:19+00:00Added an answer on May 31, 2026 at 4:22 am

    I’m not totally sure if this is what you’re looking for but in perl:

    s/socket\(([^,]+),([^,]+),([^,]+)\)/socket($1,$2 | SOCK_CLOEXEC,$3)/
    

    Which means:

    s/to_substitute/substitution_string/ “Find pattern to_substitute and replace it with substitution_string“

    And I used:

    [^,]+ which means “string without comma”.

    () which are used to capture strings which are copied in substitution string with $1, $2, $3.

    I hope this helps.

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

Sidebar

Related Questions

I am completely new to regular expressions so I'm looking for a bit of
I'm pretty new to regular expressions. I have a requirement to replace spaces in
I'm new to regular expressions and would appreciate your help. I'm trying to put
I'm new to regular expressions in Java (or any language, for that matter) and
I am looking for help in creating a Regular Expression that validates a URL
I am looking for suitable replacement code that allows me replace the content inside
I fairly new to regular expressions and need some help. I need to filter
I have c# code that is minifying my css file through multiple regular expressions
I'm looking for a regular expression to use in Refex.Replace that allows me to
I'm new to Regular Expressions and things like that. I have only few knowledge

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.