Regular Expression Explorer for IntelliJ IDEA.
Allows you to experiment with Java regular expressions in a dynamic environment.
You can "debug" your regular expressions and check each match and group of the expression. its similar to http://brosinski.com/stephan/archives/000028.php (but not so sofisticated).
After installing the plugin a new toolwindow is available at the bottom of intellij. just enter a expression pattern and a text to search for that expression and press the button or return. use the hyperlinks to get the details of the match.
Make sure you have at least idea build 922 installed.
There are a pair of buttons on the plugin that require some explanation.
Clipboard -> Regex
If you select all of a Java String declaration and copy it, then click on this button. We parse the string for the regular expression automatically handling all of the escape characters and then paste the corrected expression into the Pattern window.
Regex -> Clipboard
This will copy the regular expression from the pattern window and create a valid Java String on the clipboard so that you can paste it back into your source code. Note that this function varies according to whether the Comments flag is set or not.
Between these two buttons you shouldn't have to worry about manually editing the expression to correctly escape all of the \ characters in the expression.
Take the following expression (which strips out the contents of Java Strings):
final Pattern javaStringPatternPreserveWS = Pattern.compile(
"(?: \n" +
" # First look for a non-escaped quote character \n" +
" (?:(?<!\\\\)\") \n" +
" # Then look for the string contents \n" +
" (.*?) \n" +
" # Finish with a closing non-escaped quote \n" +
" (?:(?<!\\\\)\") \n" +
" # The allow this sequence to be repeated with plus \n" +
" # signs joining the strings \n" +
" (?:\\s*\\+\\s*)* \n" +
") \n", Pattern.COMMENTS |Pattern.MULTILINE );
If you copy all of this and then click on the Clipboard -> Regex button then we extract the multi-line regular expression and paste it into the Pattern window. If you manually paste it into the Text window and then click on the Comments check box, you see that much of the text is underlined in the results window. If you click on a particular result then you can see the details of the specific match in the details window.
e.g.
- regex of jdk1.4
- shows matches and groups of each match (if available)
- thanks to Guy Gascoigne-Piggford now there are multiline texts and patterns
- Guy again has improved the plugin (paren matching and syntax highlighting in the regex entryfield, quick reference page)
- Matcher.replaceAll and replaceFirst supported
Please see the topic RegexPluginDev, any feedback is welcome
- 0.1
- just put the jar (see below) into your IntelliJ/plugins dir
- restart IntelliJ
- 0.2, 0.3, 0.5
- extract the zip into the idea plugins dir
- restart Aurora
| Plugin Author: | GuyPiggford, ChristianKoestlin |
| Plugin Version: | 2004-02-04 (V0.5.4) |
| Change History: | |
| 04 Feb 2004 (V0.5.4): | Fix for bug in library export |
| 02 Feb 2004 (V0.5.1): | Fix a npe when opening a new project |
| 02 Feb 2004 (V0.5.0): | Add library support, add standalone support |
| 14 Dec 2003 (V0.3.3): | new features by guy, works with Aurora 992, paren matching, syntax highlighting, quick reference |
| 20 Oct 2003 (V0.3.1): | Minor change to support Idea 957, should still work with earlier versions though. |
| 11 Oct 2003 (V0.3): | replaceFirst and replaceAll of Regexes supported, different packaging |
| 7 Oct 2003 (V0.2): | multiline text and pattern and regexflags (thanks to Guy Gascoigne-Piggford) |
| 18 Sep 2003 (V0.1.1): | simple exeptionhandling for illegal regular expressions, gui elements reordered |
| 12 Sep 2003 (V0.1): | Initial version |
| Jar Dependencies: | none |
| Plugin Home: | http://www.intellij.org/twiki/bin/view/Main/RegexPlugin | Feedback: | http://www.intellij.org/twiki/bin/view/Main/RegexPluginDev
Related Topics: PluginDocumentation, ProjectPluginTemplate, OpenAPI, IntellijPluginDocumentation,
IntellijPluginDocumentation, PluginDeployment, IdeasForPlugins
|
|