using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\d+\s+Timer.*?PHY Status 0x[01]+ - 0x[01].*?tx_p3a_d1en[\s]+0[x\w])+\s+";
string input = @"000 Timer 0x00000000_0002a465 - 0x00000000_0021453e us: Gen1 - Gen1, DETECT.QUIET - DETECT.QUIET: Status 0x00000030 - 0x00000030: L2R_reason 0x00000000: PHY Status 0x01010000 - 0x01010000
Lane 00:
pga_gain 3, pga_off1 0, pga_off2 1, ph_ofs_t -44,
cdfe_a2 52, cdfe_a3 64, cdfe_a4 118, cdfe_a5 71, cdfe_a6 12, cdfe_a7 124, cdfe_a8 24, cdfe_a9 76, cdfe_a10 49,
zobel_a_gain 12, zobel_b_gain 0, zobel_dc_ofs 260, dc_ofs 25, udfe_thr_0 -152, udfe_thr_1 14, median_amp 179,
cdru_lock_count 0, eh_workaround_stat 0x0, los_toggle_cnt 0x8000, adapt_time 207872, cdr_lock_toggle_cnt 0x3000, jat_stat 0x804d
fs_obs 0, lf_obs 0, pre_cursor 0, cursor 0, post_cursor 0, usp_tx_preset 0x0, dsp_tx_preset 0x0
tx_p1a_d1en 0x30, tx_p1a_d2en 0xf, tx_p1a_amp_red 0x0, tx_p1b_d1en 0x3f, tx_p1b_d2en 0x0, tx_p1b_amp_red 0x0
tx_p2a_d1en 0x3f, tx_p2a_d2en 0x0, tx_p2a_amp_red 0x0, tx_p2b_d1en 0x3f, tx_p2b_d2en 0x0, tx_p2b_amp_red 0x0 tx_p3a_d1en 0x28
Lane 01:
pga_gain 15, pga_off1 24, pga_off2 6, ph_ofs_t -57,
cdfe_a2 -106, cdfe_a3 120, cdfe_a4 -80, cdfe_a5 -31, cdfe_a6 -13, cdfe_a7 127, cdfe_a8 96, cdfe_a9 127, cdfe_a10 4,
zobel_a_gain 0, zobel_b_gain 0, zobel_dc_ofs 457, dc_ofs 217, udfe_thr_0 -215, udfe_thr_1 219, median_amp 176,
cdru_lock_count 0, eh_workaround_stat 0x0, los_toggle_cnt 0x8000, adapt_time 207872, cdr_lock_toggle_cnt 0x3000, jat_stat 0x804d
fs_obs 0, lf_obs 0, pre_cursor 0, cursor 0, post_cursor 0, usp_tx_preset 0x0, dsp_tx_preset 0x0
tx_p1a_d1en 0x30, tx_p1a_d2en 0xf, tx_p1a_amp_red 0x0, tx_p1b_d1en 0x3f, tx_p1b_d2en 0x0, tx_p1b_amp_red 0x0
tx_p2a_d1en 0x3f, tx_p2a_d2en 0x0, tx_p2a_amp_red 0x0, tx_p2b_d1en 0x3f, tx_p2b_d2en 0x0, tx_p2b_amp_red 0x0 tx_p3a_d1en 0x28
";
Match m = Regex.Match(input, pattern);
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