if((reg_status1 == "on" || reg_status2 == "on") && uslovie == "on") {
$('#submit_r').removeAttr('disabled');
}
else {
$('#submit_r').attr('disabled', 'disabled');
}
static void Main(string[] args)
{
var subject = "one {1|2|4} text, {1|3|3} tut {2|2|3} нет и {1|1|3}";
var keys = new [] { "3", "2", "1", "2" };
var intKeys = keys
.Select(x => int.TryParse(x, out var key) ? key : -1 )
.ToArray();
var result = subject
.Split('{', '}')
.Select((x, i) => (i % 2 != 0 && intKeys[i/2] >= 0) ? x.Split('|').ElementAt(intKeys[i/2] - 1) : x)
.Aggregate((x, y) => x + y);
Console.WriteLine(result);
Console.ReadKey();
}
static void Main(string[] args)
{
var subject = "{1|2|4} text, {1|3|3} tut {2|2|3} нет и {1|1|3}";
var keys = new [] { "3", "2", "1", "2" };
var parts = subject.Split('{', '}');
var result = new StringBuilder();
for (var i = 0; i < parts.Length; i++)
{
if (i % 2 != 0)
{
var templates = parts[i].Split('|');
var isParse = int.TryParse(keys[i/2], out var key);
if (isParse)
{
result.Append(templates[key - 1]);
}
}
else
{
result.Append(parts[i]);
}
}
Console.WriteLine(result);
Console.ReadKey();
}