Q:

Regex pattern works in javascript but fails in scala with PatternSyntaxException: Unclosed character class

Here is the regex:
ws(s)?://([0-9\.a-zA-Z\-_]+):([\d]+)([/([0-9\.a-zA-Z\-_]+)?

Here is a test pattern:
wss://beta5.max.com:18989/abcde.html

softlion.com likes it:
Test results
Match count: 1

Global matches:
wss://beta5.max.com:18989/abcde.html

Value of each capturing group:
0    1   2   3   4
wss://beta5.max.com:18989/abcde.html     s   beta5.max.com   18989   /abcde.html

scala does not:
val regex = """ws(s)?://([0-9\.a-zA-Z\-_]+):([\d]+)([/([0-9\.a-zA-Z\-_]+)?""".r

Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 58
ws(s)?://([0-9\.a-zA-Z\-_]+):([\d]+)([/([0-9\.a-zA-Z\-_]+)?

A:

My bad, I had an extra [ at the front of the last capturing group. 
([/([0-9.a-zA-Z-_]+)?

