Sublime Forum

Msbuild file_regex help

#1

Hi all. I’m trying to put together a good msbuild script for sublime. I have the build part working, but I’m having some trouble getting the file_regex part to work. I’m trying to set it up so I can double click on an error to have it jump to a line number. (I’m using visual studio 2005 on windows xp)

Here’s my build file so far

{ "cmd": "msbuild"], "path": "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319", "working_dir": "$file_path" "file_regex": "^\\s*\\.\\(.*)\\(.*" "line_regex": "^.*\\(([0-9]*)\\)" }

A single error line looks like:

    .\MyProgram.cpp(695): error C2039: 'myvariable' : is not a member of 'myProgram::myProgram' [C:\SVN\MyProgram\MyProgram.sln]

The regular expression I created to parse it is

^\s*\.\\(.*)\(.*

which escaped should be

^\\s*\\.\\(.*)\\(.*

But, It doesn’t seem to be picking up the slash character after the dot before MyProgram.cpp correctly. The first \s is escaped to \s, and the second . is escaped to \. However, the third \ which is just supposed to match a slash stays the same. Should this be escaped to something? I’ve tried \\ which doesn’t work. Has anyone else run into this? Thanks!

0 Likes

#2

I assume you shouldn’t be escaping \s

^\s*\\.\\\\(.*)\\(.*
  • assuming you’re looking for ‘\’ ? Otherwise, maybe:
^\s*\\.\\(.*)\\(.*
0 Likes