DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Jakarta NoSQL: Why JPA Is Not Enough for the AI Era
  • Top Java Security Vulnerabilities and How to Prevent Them in Modern Java
  • A Spring Boot App With Half the Startup Time
  • Implementing the Planning Pattern With Java Enterprise and LangChain4j

Trending

  • How to Format Articles for DZone
  • Mastering Fluent Bit: Beginners' Guide for Contributing to Our CNCF Project Website
  • Testing AI-Infused Apps: A Dual-Layer Framework for AI Quality Assurance
  • Generative Engine Optimization: How to Make Your Content Visible to AI
  1. DZone
  2. Coding
  3. Java
  4. Java: RegEx: Splitting A Space-, Comma-, And Semi-colon Separated List

Java: RegEx: Splitting A Space-, Comma-, And Semi-colon Separated List

By 
Snippets Manager user avatar
Snippets Manager
·
Aug. 05, 07 · Code Snippet
Likes (1)
Comment
Save
Tweet
Share
38.1K Views

Join the DZone community and get the full member experience.

Join For Free
// Greedy RegEx quantifier used
//   X+ = X, one or more times
//   [\\s,;]+ = one or more times of either \s , or ;


    String test_data = "hello world, this is a test, ;again";
    _logger.debug("Source: " + test_data);
    
    for (String tag : test_data.split("[\\s,;]+"))
    {
      _logger.debug("Received tag: [" + tag + "]");
    }
Java (programming language)

Opinions expressed by DZone contributors are their own.

Related

  • Jakarta NoSQL: Why JPA Is Not Enough for the AI Era
  • Top Java Security Vulnerabilities and How to Prevent Them in Modern Java
  • A Spring Boot App With Half the Startup Time
  • Implementing the Planning Pattern With Java Enterprise and LangChain4j

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook