0

Getting down and dirty with the regex implementation in Java, I spent a good two hours today troubleshooting a regex that was supposed to match consecutive whitespaces, but didn't. After googling and swearing, I found out that it was because i had to do String args[] = line.split("\\s+");.

What is the reason for the double backslash in java, as opposed to the split(/\s+/) that I'm used to from perl?

Sorry if this is a silly question, but I need this to make sense to me, and at the moment it doesn't.

user2864740
  • 57,407
  • 13
  • 129
  • 202
Jarmund
  • 2,796
  • 4
  • 18
  • 42

0 Answers0