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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:19:10+00:00 2026-06-04T20:19:10+00:00

I am attempting to do some find and replace on a java source file.

  • 0

I am attempting to do some find and replace on a java source file.

Currently my classes have invalid names (imported from a tool that did poor auto naming) of the form:

public class [0-9]{2}[A-Za-z]+

I would like to insert underscores around the digits, resulting in a valid class name of the form

public class [_][0-9]{2}[_][A-Za-z]+

However using Eclipses find and replace tool, with the regex box check on both the find and replace strings does not format the output as I’d like.

It takes

02ListOfValidAppIDs

and makes it

[-][0-9]{2}[_][A-Za-z]+

instead of

_02_ListOfValidAppIDs

How can you make the regex keep the arbitrary number and text and just plug them in for the replace string?

(Edit: As a note, with the preview feature I can see that eclipse is correctly finding all of the names I wish to replace, and nothing else)

  • 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-04T20:19:11+00:00Added an answer on June 4, 2026 at 8:19 pm

    I’m not sure of the exact flavor of Regex that you’ll need, but something like this should get you started in the right direction.

    Update your “Find” pattern to use capture groups:

    (public class )([0-9]{2})([A-Za-z]+)
    

    And then reference those captures in the replacement:

    \1_\2_\3
    

    NOTE: Some flavors of Regex will use {} instead of () to represent a captured group, and some flavors will use $1, $2, $3, etc. as the reference instead of using \#.

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

Sidebar

Related Questions

I'm attempting to mock some file operations. In the real object I have: StreamWriter
I have some question related to project building in Java . When attempting to
I am attempting to replace some undesirable characters in a string retrieved from an
I'm attempting to pull some data from a SQLite database so that I can
I am attempting to add some entities that I have created. When I try
I am attempting to get some information from a website, the info that I
I am attempting to run some unit tests in python from what I believe
I am attempting to tune some stored procedures and have a question on indexes.
Currently attempting to get some code to compile using Lejos for the Lego NXT
Morning Everyone, I've been attempting to write an application that does some GETs from

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.