Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Account For Which Logon Failed:\s*.*\s*Account Name:\s*(.+?)"

Above regex giving me result as : Account For Which Logon Failed: Account Name:Test123 Account Domain:aaa Source Network Address:0.0.0.0"

Now want to find substring from above resultset to get the string "Account Name:Test123" by another regex.

What I have tried:

Account For Which Logon Failed:\s*.*\s*Account Name:\s*(.+?)"
Posted
Updated 17-Apr-21 4:44am

Use the Groups feature: they include "Match Prefix but exclude it" and "Match Suffix but exclude it":
(?<=Account\sFor\sWhich\sLogon\sFailed:\s*)Account\sName:\s*(.+?)(?=\s*Account\sDomain:)
 
Share this answer
 
Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
RegExr: Learn, Build, & Test RegEx[^]
Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx: Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
This site also show the Regex in a nice graph but can't test what match the RegEx: Regexper[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900