What makes scala.util.matching.regex library different from java.util.regex library?

As a Java developer learning Scala, I was surprised to find a separate Scala library for regular expressions. The major difference seems to me to be that a lot of the Scala operations return an Option[String]. Is that the key difference or is there more I'm missing there in how those libraries are used?


See what it is written in the scala.util.matching.Regex documentation:

This class delegates to the java.util.regex package of the Java Platform. See the documentation for java.util.regex.Pattern for details about the regular expression syntax for pattern strings.

So, the regex library used is java.util.regex, thus, the syntax is the same and all the shortcomings are the same.

Just in Scala, you can use single backslashes inside triple quoted strings.

If you were to compare methods that you have in Scala, then there are some differences. A nice method is findAllIn/findAllMatchIn and some others.

Need Your Help

Doctrine Proxy not found

symfony doctrine-orm symfony-cmf doctrine-phpcr

I'm trying to set up the Symfony CMF with Doctrine PHPCR-ODM. Unfortunately, whenever I want to save some data from Sonata Admin into the database, I get the following exception:

How to do NHibernate queries with reference as criterion?

c# .net nhibernate

I'm trying to do a query through NHibernate where the criterion for the result depends on a referenced table. How do I do this? Let's look at a simple example: