• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regular Expression Confusion  RSS feed

 
Samar Bir
Greenhorn
Posts: 23
IntelliJ IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!