Created
August 7, 2016 14:15
-
-
Save tonykambo/262c09e4fe8f90fe74cffd30555e3eb4 to your computer and use it in GitHub Desktop.
Everything is between / / ( ) - captures the match in a variable (in this case the array \d+ - captures 1 or more digits \d{1} - matches exactly 1 digit \s{1} - matches exactly 1 space \S+ - matches a single character other than whitespace .+ - matches one or more characters (including whitespaces) \[ - escapes [ so it is treated as a literal ch…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var syslog = '<14>1 2016-08-07T03:25:39.198284+00:00 loggregator 765a363b-3467-436c-3d69-6b6789533456 [APP/0] - - 7 Aug 03:25:39 - [error] [function:faf0b791.050f48] This is an error from noderedapp'; | |
var regSys = /<(\d+)>(\d{1})\s{1}(\S+)\s{1}(\S+)\s{1}(\S+)\s{1}(\S+)\s{1}-\s{1}-\s{1}.+-\s{1}\[(\S+)\]\s{1}\[(\S+)\]\s{1}(.+)/; | |
var breakdown = regSys.exec(syslog); | |
console.log(typeof regSys); | |
console.log(breakdown); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment