I'm trying to create a syntax highlighter that matches custom headers in my logs. Here's an example:
SYSTEM INFORMATION
Memory
----------------------------------------
Total 14841733120
Free 12260917248
Active 583532544
Swap Total 5009104896
Swap Free 5009104896
% Used 3
% Swap Used 0
Disk
----------------------------------------
Total 114272681984
Free 107483385856
% Used 5
What I want to match is the header line (eg, Memory) and the following line's dashes. I've developed a regex pattern to do just this:
^[\w|\ ]+(\ {0,})\n(\-{40})
Unfortunately, when I try to create a custom syntax highlighter, this regex no longer matches.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://ift.tt/vvUEPL">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string></string>
</array>
<key>name</key>
<string>mylog</string>
<key>patterns</key>
<array>
<dict>
<key>comment</key>
<string>section header</string>
<key>match</key>
<string>^[\w|\ ]+(\ {0,})\n(\-{40})</string>
<key>name</key>
<string>constant.character.mylog</string>
</dict>
</array>
<key>scopeName</key>
<string>text.mylog</string>
<key>uuid</key>
<string>unique-uuid</string>
</dict>
</plist>
Any suggestions on getting the custom syntax highlighter to match both lines?
No comments:
Post a Comment