Строка, которую мы получаем в нашем документе:
18.1Commitment fee
(a)The Parent shall pay to the Agent a fee in the Base Currency computed at the rate of:
(i)35 per cent. of the Margin per annum on that Commitment under Facility A for the Availability Period applicable to Facility A;
(ii)40 per cent. of the Margin per annum on that Commitment under Facility B for the Availability Period applicable to Facility B;
Ни у одного из них нет пробела (например ...) - Ожидаемый результат ниже:
18.1 Commitment fee
(a) The Parent shall pay......
(i) 35 per cent of the margin....
(ii) 40 per cent of the margin....
Как добавить сортировкув случае если число, то добавьте пробел ... если (а), то добавьте пробел, если такие цифры, как (i), добавьте пробел
Ниже - Regex.Replace (s, @ "^ (\ d + (?:.\ d {1,2})?) (?! [\ d \ s]) (. *) "," $ 1 $ 2 ") работает над числом - предоставлено Wiktor Stribiżew