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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:53:59+00:00 2026-06-14T06:53:59+00:00

I have a parsing question. I have sentences that are stored as Strings. I

  • 0

I have a parsing question.
I have sentences that are stored as Strings. I want to grab each word in each sentence however I would like to filter which words I grab. For example say I have a sentence like the following:

Hell0 3v3ryb0dy @ stackoverflow $people \implies queen$ equals ~queen –> ~people.
/#logic

I would do the following:

  1. grab ‘H3ll0’
  2. grab 3v3ryb0dy
  3. throw away the @
  4. grab ‘people’ from ‘$people’
  5. grab ‘implies’ from ‘\implies’
  6. grab ‘queen’ from ‘queen$’
  7. grab ‘equals’
  8. grab ‘queen’ from ‘~queen’
  9. throw away –>
  10. grab ‘people’ from ‘~people’
  11. grab ‘logic’ from ‘/#logic’

Essentially I want only alphanumeric characters and whenever I have some other character such as a \ before or after a word I want to disregard this other character.

Currently I am doing:sentence.split(" ")

This gets the individual words from the sentence but it grabs ‘$people’ and ‘~people’ and treats them differently when I want them to be treated the same.

  1. How can I achieve this?
  2. Would a regex help me here?
  • 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-14T06:54:00+00:00Added an answer on June 14, 2026 at 6:54 am

    Split the string with this regex \\W+, split at one or more non-word character(s).

    String sentence = "Hell0 3v3ryb0dy @ stackoverflow $people \\implies queen$ equals ~queen --> ~people. /#logic";
    String[] split = sentence.split("\\W+");
    System.out.println(Arrays.asList(split));
    

    Output

    [Hell0, 3v3ryb0dy, stackoverflow, people, implies, queen, equals, queen, people, logic]

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

Sidebar

Related Questions

I have question about parsing in Html helper : I have sth like: @foreach
I have a question: I am parsing an XML that has a namespace with
My question is related to DOM parsing getting triggered, i would like to know
I have a question in parsing XML. How can I parse out the value
I have quick question about text parsing, for example: INPUT=a b c d e
Im not sure if endian is the right word but.. I have been parsing
I have a problem parsing a XML file which contains special characters like ,
I have a basic jQuery selector question. Let's say I'm parsing JSON and generating
All, I know I have asked a similar question on parsing an ISO8601 date
Mine is a general question on XML parsing practices. Lets say we have an

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.