• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Regular Expression Confusion

 
Greenhorn
Posts: 23
IntelliJ IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

I am trying to understand Scanner. Here is a example of javacodegeeks. The source code is



On point-1, it is using delimiter a regular expression. Does this regular expresson mean, any number of spaces followed by the coma?
Kindly help.
Thanks,
Samarbir
 
Sheriff
Posts: 17734
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

You can find a number of Java regex testers that can be used to help you test.
 
Samar Bir
Greenhorn
Posts: 23
IntelliJ IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Junilu,

Thanks for reverting back. What i understood from using the testers, this regex means, a comma following or preceded by a space. zero or one occurance.
Do let me know, if i am getting it correct?

Thanks,
Samarbir
 
Junilu Lacar
Sheriff
Posts: 17734
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks reasonable to assume so but honestly, I'd have to go and test it myself. Since it looks like you've already done that then you're better off trusting the results of your tests than my opinion.
 
reply
    Bookmark Topic Watch Topic
  • New Topic