How to check your RegExps in IntelliJ IDEA 11?

Konstantin Bulenkov

In IntelliJ IDEA 11 you can check your Regular Expressions while coding without leaving the IDE. Just invoke the ‘Check RegExp’ intention action on a regular expression and play!

Tip: You can turn any string into a regular expression by injecting RegExp language. Try the ‘Inject Language’ intention action.

Comments below can no longer be edited.

22 Responses to How to check your RegExps in IntelliJ IDEA 11?

  1. Joe says:

    November 4, 2011

    Even better would be to see how the groups of the regexp apply to the sample text.

  2. Stephen Friedrich says:

    November 4, 2011

    Is this supposed to work in 110.291?
    The popup is so small that the “Sample” field is invisible.

    +1 for support for groups.

  3. Joachim Arrasz says:

    November 4, 2011

    This is just awesome!!!

  4. Konstantin Bulenkov says:

    November 4, 2011

    @Stephen Popup autoresizes when needed.
    @Joe you mean show all groups below the Sample text box?

  5. Ingo says:

    November 4, 2011

    Great feature, also +1 for groups!

  6. xBlackCat says:

    November 4, 2011

    Autoresize is not working.

    I’ve open two projects and after the popup is shown the focus moves to second project and all typed letters are appeared in the second project editor.

    Please, prevent input field from collapsing.

    +1 for show group captures.
    I prefer to see matched group strings at the right of popup component as string.

    May be it is better to replace popup hint with dialog. Or move testing regex to pane (like it was in RegexPlugin

  7. m.milicevic says:

    November 4, 2011

    I have same issue as Stephen, no way I can resize nor access example field 🙁 I just see a small line. Probably because I changed application default font or something (I am on linux, gnome if that matters)

  8. magicprinc says:

    November 5, 2011

    +1 for RegexpPlugin – very good plugin

  9. Brice says:

    November 8, 2011

    Agreed, this is just super neat!

  10. Brice says:

    November 8, 2011

    By the way did you remove the Java regex constructs from the autocompletion popup in Jvascript regexes.

    (This behaviour might be present for other language.)

  11. Mark says:

    November 9, 2011

    Nice feature. Unfortunately I am also not seeing the sample text field.

    Charles opened a YouTrack for that issue:

  12. Ivan says:

    November 10, 2011

    Look very helpfull! I’ll try to implement it in vs2011 as add-in.

  13. Mike says:

    November 15, 2011

    How do you trigger this to appear? Pressing alt-enter on a regex doesn’t offer an option to bring this up (using 110.365).

  14. Konstantin Bulenkov says:

    November 16, 2011

    Hello Mike, do you have IntelliLang plugin enabled? It’s enabled by default.

  15. Konstantin Bulenkov says:

    November 16, 2011

    @Mark, thanks. Fixed. Balloon was too close to top border – what’s the reason it changed its size

  16. Mike says:

    November 16, 2011

    I do indeed have the IntelliLan plugin enabled and the intention won’t appear. However, I should point out that the RegEx is in Groovy code. I will try it in Java code and see what happens.

  17. Ryuu says:

    December 26, 2011

    @Mike: also in groovy regexp (e.g.: /[0-9]*/) works. You have to inject “RegExp” language to the string.

  18. Viraf Karai says:

    April 23, 2012

    Yes – I too tried this in Groovy code and there are no issues.
    Here’s some sample code that works:

    def emailAds = “”
    boolean regexMatch = emailAds.matches(“s[a-z]+@[a-z]”)
    println “Regex matches: ${regexMatch}”

    * Highlight the regex above ie. s[a-z]….. (excluding the quotes)
    * Hit Alt-Enter and inject the RegExp language against that regexp.
    * Highlight that same regexp above (excluding the open and close
    * Right click and select Check RegExp.
    * You should now see the popup against which you check your regexps.
    It’s truly a beautiful thing.

    Kudos a hundred times over to Dmitry and the JetBrains team. Brilliant job and extremely usable.

  19. Joseph says:

    September 14, 2012

    I have Intellij idea 11.1.3 ultimate edition and there ain’t no Check RegExp intention among available intentions. How’s that ?

  20. Andreas says:

    February 25, 2013

    Very nice Plugin, but it would even nicer, if one could resize the pop up window und enter multiline samples.
    Als a visual feedback for group matching would be really nice.

    I know, I am completely indulged by the existing eclipse reg exp plugins 😉

  21. Nami says:

    June 2, 2014

    Hey, seems like this doesn’t recognizes some regepxs, ie in RubyMine it never matches regexps with ? syntax.

  22. Nami says:

    June 2, 2014

    Seems there’s already an issue for that !


Subscribe for updates