re = /(?:^[ ]*(?:(?:[\[])?((?:Parse)?Error): *)(((?!stdin)\S(?:[^\n:\\]+|(?:\\.)+)+)(?::(\d+)(?::(\d+))?)?) *$)/m
str = '/usr/local/lib/node_modules/stylus/bin/stylus:685
throw err;
^
[Error: /Users/user/path/to/stylus/file/invalid.styl:34:5
30| ==/UserStyle== */
31|
32| @-moz-document regexp("https?://(www\\\\.)?typescriptlang.org/(v2/)?docs.*$"),
33| regexp("https?://(www\\\\.)?(staging-)?typescript\\\\.org/docs/.*$")
34| error("compile error")
-----------^
35|
Error: test.styl:3:62
1| ensure(val, type)
2| unless val is a type
3| error(\'expected a \' + type + \', but got \' + typeof(val))
-------------------------------------------------------------------^
4|
5| border-radius(n)
6| ensure(n, \'unit\')
expected a unit, but got string
at ensure() (test.styl:2:17)
at border-radius() (test.styl:6:16)
at "body" (test.styl:10:18)
assert that
regex
does match'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html