Category : regex

I want to find and replace value in string by exact value what I have in array of object. Example: const body = ‘<p> some value <span>{{first_variable}}</span>{{second_variable}}</p>’; const valueForVariables = [ { first_variable: ‘first variable’ }, { second_variable: ‘second variable’ } ] So I need replace all occurrence and receive this result: const result = ..

Read more

I have regular expression to check a number with 12 or 13 digits that start with 0 but it does not work well and I don’t know why here is my TextBox: @Html.TextBoxFor(x => x.ClientProfileModel.ClientMobile, new {@onblur= "CheckPhone(this.Value,this.id)", @id = "StudentPhone"}) and this is my Function: function CheckPhone(input, id) { try { var reg = ..

Read more

I need a string: length between 3 and 30 – {3,30} no to repeating the first letter more than once – /^(?:([A-Za-z])(?!)) no to the repetition of the same letter more than two consecutive times – /^(?:([A-Za-z])(?!{2})) after the first three letters there can be only one space E.G. "iioy" no; "ioy" yes; "ioyy" yes; ..

Read more

It’s hard to explain, but I need a function that does something like this: input: cleanStr(" console.log(‘abc’ + ‘defg’) ") output: "console.log(‘abcdefg’)" input: cleanStr(" console.log([‘abc’ + "123", ‘other’, ‘other’]) ") output: "console.log([‘abc123’, ‘other’, ‘other’])" input: cleanStr(" console.log({ "key": "abc" + ‘def’, "other": (‘hello ‘) + ‘world’ }) ") output: "console.log({ "key": "abcdef", "other": ‘hello world’ ..

Read more

hello I have a TextBoxFor that should only except numeric values but whatever I write it returns false and will empty the textbox here is my textbox: @if (string.IsNullOrEmpty(clientProfile.ClientCertificateCode)) { @Html.TextBoxFor(x => x.ClientProfileModel.ClientCertificateCode, new { @onblur = "NumbersAlllowed(this.Value,this.id)" })} else { @Html.TextBoxFor(x => x.ClientProfileModel.ClientCertificateCode, new { @Value = clientProfile.ClientCertificateCode, @readonly = "readonly" }) } and ..

Read more