Regex path matching in chaotic input -


i have chaotic log output looks below (yes weird new lines exist @ place. :)

c:\testing\testpath\testfile.txt \\1.2.3.4\c$\test\testpath1\testpath2\k \\1.2.3.4\c$\test\testpath1\testpath2\ c:\ro\row\rou\line.txt:line 234 failed grant assetid=33683041 userid=44129434: recipient owns asset @ corp.userasset.awarduserasset(int6 4 assetreferenceid, int32 userid, boolean preventduplicates, boolean& awardednewasset)  in d:\workspace\trunk\assemblies\scl\ccl\bll\userasset.cs:line 723 @ corp.userasset.awarduserasset(int64 assetreferenceid, int32 userid, boolean preventduplicates) in d:\workspace\trunk\assemblies\scl\ccl\bll\userasset.cs:line 710 @ corp.website.badge.award.processrequest(httpcontext context) in d:\workspace\trunk\web\corpwebsite\badge\award.ashx.cs:line 111 @  system.web.httpapplication.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() @ system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) 

what out of regex this:

c:\testing\testpath\testfile.txt \\1.2.3.4\c$\test\testpath1\testpath2\k \\1.2.3.4\c$\test\testpath1\testpath2\ c:\ro\row\rou\line.txt:line 234 d:\workspace\trunk\assemblies\scl\ccl\bll\userasset.cs:line 723 @ corp.userasset.awarduserasset(int64 assetreferenceid, int32 userid, boolean preventduplicates) in d:\workspace\trunk\assemblies\scl\ccl\bll\userasset.cs:line 710 @ corp.website.badge.award.processrequest(httpcontext context) in d:\workspace\trunk\web\corpwebsite\badge\award.ashx.cs:line 111 @ system.web.httpapplication.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() @ system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) 

i have following regex

([\w]:\\|\\\\)([^\r\n]*) 

but result not quite there getting first 4 lines last error line comes out single line instead of 3. , wondering if need can done single regex.

use one:

([\w]:\\|\\\\)(([^\r\n](?!([\w]:\\|\\\\)))*) 

i added negative look-ahead ((?!...)) right after [^\r\n] prevent keep matching if starting pattern met again. find straightforward got.

check result: http://regexr.com?35mjh


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -