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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:17:04+00:00 2026-06-14T18:17:04+00:00

In my source code, it has the following for example: menu = add_menu_item ((char

  • 0

In my source code, it has the following for example:

menu = add_menu_item ((char **)HW_KIND, 21);
.
.
if(get_idx_by_str ((char **)HW_KIND, prev->column_section, 21, 0) < get_idx_by_str ((char **)HW_KIND, curr->column_section, 21, 0))
.
.
fprintf(fp, "# %d floor\n%d@%d\n\n", i, get_idx_by_str ((char **)HW_KIND, section->column_section, 21, 0), stop->stop_landing);
.
.
add_text_to_gtk_text_buffer (text_buffer, iter, NULL, -99, -99, "??????????Ե -- %s\n", HW_KIND[steel_col_data.sec_idx]);

I wanted to find all the sentences having exactly key HW_KIND then also 21 and then change 21 to 20. For example, the first three sentences above match the searching condition but the last one above doesn’t.

If in a terminal in Linux, grep "\<HW_KIND\>" foo.c | grep 21 will find all occurrences. How to define the substitute command in Vi editor?

Thank you.

  • 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-14T18:17:05+00:00Added an answer on June 14, 2026 at 6:17 pm

    You can use the following regex:

    :%s/\(.\{-}HW_KIND.\{-}\)21\(.\{-}\)/\120\2/gc
    

    With c option, you can confirm each replacement.
    Try the above regex and watch it replaces the text as you want.
    It will replace 4 matches.

    \( and \) for capturing group, and \{-} for non-greeding match.

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

Sidebar

Related Questions

For the following example (from mysql source code), it uses Field **field. I am
I am using following example source code but I can't get long distance route
In eclipse IDE, how can I see the javascript source code GWT has generated
We have a Japanese client that has source code in COBOL on an mainframe.
Has Java always maintained source-code backward compatibility during its development? More precisely: given two
Has anyone ever used the hidden class PackageParser in Android source code with java
I have java source code in a text file. There has to be entered
wsimport generates source code without parameterized constructors. Therefore, if the bean has many properties,
I was going through the source code of ArrayBlockingQueue and LinkedBlockingQueue. LinkedBlockingQueue has a
I am writing a server application which has a large amount of source code.

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.