There are many differences that are summarised here.
The most important ones are:
- In Java strings, you need to escape all the backslashes (
@"\s"
becomes "\\s"
)
- Java does not support named capturing groups
- Java does not support infinite repetition inside lookbehinds.
- Java does not support conditionals (
(?(?=regex)then|else)
)
- Unicode properties are named differently.
Most other differences are minor. One difference that is not mentioned above is Java's lack of support for balanced (recursive) regexes which I hope you don't have to use, ever.
If you need to convert lots of complicated regexes, consider investing in RegexBuddy which will do that for you.