editor doesn't like /^\s+$/

  • Chris Brown

    Chris Brown - 2009-04-29


    This isn't show-stopper but I'm curious to know whats going on.

    I've been using eclipse for a while and had a problem opening a file containing the following regular expression
    sub blah {
       if ($outer !~ m/^\s+$/) {
          if ($inner) {


    I changed the expression to /^\s{1,}$/ and was able to open the file but something strange is now happening with eclipse's brace matching. The closing brace of the outer if statement is matched with the opening brace of the subroutine.

    The orphaned closing brace seems to interpreted as the end of the package and any following subroutines are shown in package main in the outline view.

    If I place the cursor on the opening brace of the outer if statement the text show below is highlighted in the same way the editor highlights a variable name under the cursor (along with all other instances in the file). The greyed area extends from the closing / of the regexp to the opening bracket after the inner if keyword.

    /) {

       if (

    Does anyone know what the cause is?


    • Jan Ploski

      Jan Ploski - 2009-04-29

      Which version of EPIC? I cannot reproduce the problem you describe by pasting the sub into a new file in 0.6.33. Brace matching also works as expected after your suggested change.

    • Chris Brown

      Chris Brown - 2009-04-30

      I'm running version 3.4.2 of eclipse and version 0.6.33 of EPIC.

      I also had a look at the file in vim to view hidden chars; there was nothing.

    • Chris Brown

      Chris Brown - 2009-04-30

      Is it possible the range of highlighted text is being treated as a variable?

      I also have templates set up for vars such as $/ that I acquired via a forum. Could there be an issue here?

      • Jan Ploski

        Jan Ploski - 2009-04-30

        Send me the file which you use to reproduce the problem (by just opening it?). Templates should not be an issue here (but you can do an experiment yourself by removing them).


Log in to post a comment.