Home:ALL Converter>How to specify positions that will be replaced with Regular expression

How to specify positions that will be replaced with Regular expression

Ask Time:2019-10-03T19:43:04         Author:Arthur

Json Formatter

I have regular expression (?!\,)(?!X){3}[0-9\.\w\s\+\-\:\,]+ and strings like

"1", "S1", "S2", "1", "2"
"1", "S1", "S2", "1", 2
"1", "S1", "S2", "1", "2", 3

I am trying to parse that string with Regex (by matches) and I am not strong in regular expressions.

I need to process elements "1", "S1", "S2" and to skip elements "1", "2". The first idea is to specify in regular expression logic like "don't take occururences, that are first from right ("2"-2) and second from right ("1"-1), but take all other occurences".

The main idea is that this logic should be made with only regular expression, not by C# code (I am talking about Match object position in C# matches array - no C# logic, regular expression should be used only).

How can I change my regular expression (?!\,)(?!X){3}[0-9\.\w\s\+\-\:\,]+ to specify positions, that are should not be processed?

Author:Arthur,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/58218413/how-to-specify-positions-that-will-be-replaced-with-regular-expression
yy