using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"((maildir=cipec\.com\.br.*\/)|(clearpasswd.*\,))";
string input = @"3-Sep 1 08:40:59 srvmail authdaemond: password matches successfully
4-Sep 1 08:40:59 srvmail authdaemond: authmysql: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, address=helio@cipec.com.br, fullname=<null>, maildir=cipec.com.br/helio/, quota=<null>, options=<null>
5:Sep 1 08:40:59 srvmail authdaemond: authmysql: clearpasswd=<null>, passwd=pdsPDnYTP3gyw
6-Sep 1 08:40:59 srvmail authdaemond: Authenticated: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, address=helio@cipec.com.br, fullname=<null>, maildir=cipec.com.br/helio/, quota=<null>, options=<null>
7:Sep 1 08:40:59 srvmail authdaemond: Authenticated: clearpasswd=hel733, passwd=pdsPDnYTP3gyw
8-Sep 1 08:40:59 srvmail pop3d: LOGIN, user=helio@cipec.com.br, ip=[::ffff:10.0.1.103], port=[46999]
9-Sep 1 08:40:59 srvmail pop3d: LOGOUT, user=helio@cipec.com.br, ip=[::ffff:10.0.1.103], port=[46999], top=0, retr=0, rcvd=12, sent=39, time=0
--
42-Sep 1 08:41:02 srvmail authdaemond: password matches successfully
43-Sep 1 08:41:02 srvmail authdaemond: authmysql: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, address=antonio@cipec.com.br, fullname=<null>, maildir=cipec.com.br/antonio/, quota=<null>, options=<null>
44:Sep 1 08:41:02 srvmail authdaemond: authmysql: clearpasswd=<null>, passwd=pdiHUG4qjaDnI
45-Sep 1 08:41:02 srvmail authdaemond: Authenticated: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, address=antonio@cipec.com.br, fullname=<null>, maildir=cipec.com.br/antonio/, quota=<null>, options=<null>
46:Sep 1 08:41:02 srvmail authdaemond: Authenticated: clearpasswd=ant527, passwd=pdiHUG4qjaDnI
47-Sep 1 08:41:02 srvmail pop3d: LOGIN, user=antonio@cipec.com.br, ip=[::ffff:10.0.1.103], port=[47004]
48-Sep 1 08:41:02 srvmail postgrey[1708]: action=pass, reason=client AWL, client_name=cipec.com.br, client_address=201.48.59.65, sender=return@bonustelecom.com.br, recipient=bianca@cipec.com.br
--
73-Sep 1 08:41:04 srvmail authdaemond: password matches successfully
74-Sep 1 08:41:04 srvmail authdaemond: authmysql: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, address=davi@cipec.com.br, fullname=<null>, maildir=cipec.com.br/davi/, quota=<null>, options=<null>
75:Sep 1 08:41:04 srvmail authdaemond: authmysql: clearpasswd=<null>, passwd=u3WErgO7RPtDc
76-Sep 1 08:41:04 srvmail authdaemond: Authenticated: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, address=davi@cipec.com.br, fullname=<null>, maildir=cipec.com.br/davi/, quota=<null>, options=<null>
77:Sep 1 08:41:04 srvmail authdaemond: Authenticated: clearpasswd=dav510, passwd=u3WErgO7RPtDc
78-Sep 1 08:41:04 srvmail pop3d: LOGIN, user=davi@cipec.com.br, ip=[::ffff:10.0.1.103], port=[47017]
79-Sep 1 08:41:04 srvmail pop3d: LOGOUT, user=davi@cipec.com.br, ip=[::ffff:10.0.1.103], port=[47017], top=0, retr=0, rcvd=12, sent=39, time=0
";
RegexOptions options = RegexOptions.Multiline | RegexOptions.IgnoreCase;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx