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
  • 60,010
  • 15
  • 145
  • 220
Jarmund
  • 3,003
  • 4
  • 22
  • 45

0 Answers0