const regex = new RegExp('(?<=has been denied).*(401 to \\d{1,3}.\\d{1,3}.\\d{1,3}.\\d{1,3})', 's')
const str = `2016-02-14 15:55:39.1094 Info HttpServer: HTTP Response 200 to 192.168.0.3. Time: 3ms. https://192.168.0.10:8920/emby/users/public
2016-02-14 15:55:43.8597 Info HttpServer: HTTP POST https://192.168.0.10:8920/emby/Users/authenticatebyname. UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0
2016-02-14 15:55:43.8718 Info UserManager: Authentication request for <username> has been denied.
2016-02-14 15:55:43.8820 Error DtoUtils: ServiceBase<TRequest>::Service Exception
*** Error Report ***
Version: 3.0.5821.0
Command line: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
Operating system: Unix 3.19.0.25
Processor count: 8
64-Bit OS: True
64-Bit Process: True
Program data path: /var/lib/emby-server
Mono: 4.2.1 (Stable 4.2.1.102/6dd2d0d Thu Dec 3 04:04:55 UTC 2015)
Application Path: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
Invalid user or password entered.
MediaBrowser.Controller.Net.SecurityException
at MediaBrowser.Server.Implementations.Session.SessionManager+<AuthenticateNewSession>c__asyncC.MoveNext () <0x41c76b00 + 0x0080b> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7fa7314f36d0 + 0x00029> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7fa7314f16b0 + 0x000a7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7fa7314f1630 + 0x0006b> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7fa7314f15e0 + 0x0003a> in <filename unknown>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable\`1+ConfiguredTaskAwaiter[TResult].GetResult () <0x7fa7314f1d10 + 0x00017> in <filename unknown>:0
at MediaBrowser.Api.UserService+<Post>c__async1.MoveNext () <0x41c75ea0 + 0x00680> in <filename unknown>:0
2016-02-14 15:55:43.8849 Error HttpServer: Error processing request for /emby/Users/authenticatebyname
*** Error Report ***
Version: 3.0.5821.0
Command line: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
Operating system: Unix 3.19.0.25
Processor count: 8
64-Bit OS: True
64-Bit Process: True
Program data path: /var/lib/emby-server
Mono: 4.2.1 (Stable 4.2.1.102/6dd2d0d Thu Dec 3 04:04:55 UTC 2015)
Application Path: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
Invalid user or password entered.
ServiceStack.HttpError
No Stack Trace Available
2016-02-14 15:55:43.8913 Info HttpServer: HTTP Response 401 to 192.168.0.3. Time: 32ms. https://192.168.0.10:8920/emby/Users/authenticatebyname
`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
if ((m = regex.exec(str)) !== null) {
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
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 JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions