My input is: abc1 abc2 abc3 abc4
I wont to get a
, and any chars but as few times as possible, and 3
.
the output must begins with a
, and continues with every character in the world except for something corresponding to a
, and ending with 3
, where a
is a Regax expression.
but if I use pattern: a.*?3
, the match is: abc1 abc2 abc3
, But I expecting to abc3
.
I can't use a[^a]*?3
because a
is unknown in advance.
How can I achieve this in .NET Regex?