5

There is cool feature in IDEA to check your regex in Java.
When you hit Alt+Enter over your selected pattern, you get:

image link

And if you choose Check RegExp, you get something like this:

image link

But if you try same thing using Scala there is no Check RegExp option. I've tried hitting Alt+Enter for each of following lines of code:

val myRegex = """\w""".r
val myRegex2:Pattern = Pattern.compile("""\w""")
val myregex3 = new Regex("""\w""")

but no Check RegExp option showed. Any idea how to "enable" this feature to work with Scala?

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
  • 3
    I think this is because language injection is disabled by default for Scala files for performance reasons. – ziggystar Mar 31 '14 at 20:37

1 Answers1

4

Expanding the tip of @ziggystar, if you have the IntelliLang plugin installed, you can "inject" Regex syntax into a string. There is a message though stating that the injection was temporary, and the injection doesn't survive IntelliJ restart.

Injection screenshot

Vic
  • 21,473
  • 11
  • 76
  • 97