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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:54:36+00:00 2026-05-31T16:54:36+00:00

Take the following Java string: Hello, World I want to take that string and

  • 0

Take the following Java string:

"Hello, World"

I want to take that string and turn it into:

"H, W"

There are java utilities that will turn it into “HW”, but I want to preserve the white space and punctuation. I can do this by splitting the string and processing each word individually, but that is too slow. I’m trying to find a regular expression where I can grab all letters of a word but the first? I.e, grab “ello” and “orld” and replace them with “”. I know that “\w” will grab all letters, but is there a way to exclude the first letters of each word?

  • 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-31T16:54:38+00:00Added an answer on May 31, 2026 at 4:54 pm

    The capture sequence would look something like:

    (\\w)\\w*
    

    And the replace like:

    $1
    

    The idea is you want to capture the first character as its own group, and simply consume as many extra word characters as possible.

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

Sidebar

Related Questions

I'm writing a java program that will take int input as a option from
Take the following generics example import java.util.List; import java.util.ArrayList; public class GenericsTest { private
Take the following string as an example: The quick brown fox Right now the
Take the following C# class: c1 { event EventHandler someEvent; } If there are
Take the following useless program: class Program { static void Main(string[] args) { IUnityContainer
Let's take a glance at the following code in Java. interface FirstInaterface { public
I have a Java pattern I would like to match. I want to take
Java Question: I want to take an undetermined number of lines of input from
I was surprised to find that the following code System.out.println("Character size:"+Character.SIZE/8); System.out.println("String size:"+"a".getBytes().length); outputs
Take the following snippet: List<int> distances = new List<int>(); Was the redundancy intended by

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.