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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:13:39+00:00 2026-05-24T23:13:39+00:00

75.122.1.23 I need to replace the third number with 2 so it looks like

  • 0

75.122.1.23

I need to replace the third number with 2 so it looks like 75.122.2.23

What regex can match the third section?

  • 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-24T23:13:40+00:00Added an answer on May 24, 2026 at 11:13 pm
    int replacementNumber = 2;
    ip = ip.replaceAll("(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})", "$1.$2."+replacementNumber+".$4");
    

    Commented form:

    /^                 # match beginning
        (
            \d{1,3}    # one address segment
            \.         # separation dot
            \d{1,3})   # second address segment
        \.             # separation dot
        \d{1,3}        # address segment to be replaced
        \.             # separation dot
        (\d{1,3})      # last address segment
    $/x                # match end, ignore comments
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to make a cycle over the following elements: [1,2,11,12,21,22,111,112,121,122,....,222222] or for
If I have a javascript object that looks like the following: { 0: [0,50],
I have very large dataframe and I need to choose variable number satisfying certain
I need to update multiple embedded docs in mongo using PHP. My layout looks
I need a method in C that the random number between decimal 65-90 [
I need to dynamically create in PHP a drop-down list of numerical choices like
I have a file that looks like this: 192.168.2.2 150.25.45.7 8080 192.168.12.25 178.25.45.7 50
I have a paneldata which looks like: (Only the substantially cutting for my question)
Say I have a LINESTRING defined as LINESTRING(-122.360 47.656, -122.343 47.656, -122.310 47.690, -122.310
$sql_where = ''; $exclude = '30,35,36,122,123,124,125'; if($exclude != '') { $exclude_forums = explode(',', $exclude);

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.