Please help me in regular expression in c# code:
Input: AB12(100).HJI(20).D76R(222)
Expected Output: 100.20.222 ( Integer only in brackets append with dot(.))
Current output: 1210076222
Please find my code below:
using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using System.Text.RegularExpressions; namespace CLRPlay { public partial class UserDefinedFunctions { static readonly Regex _regex = new Regex(@"[^0-9]*", RegexOptions.Compiled); static readonly string _nR = @""; [Microsoft.SqlServer.Server.SqlFunction] public static SqlString Indexkey(SqlString val) { if (val.IsNull) return SqlString.Null; return _regex.Replace(val.ToString(), _nR); } }; }
VulpesPosted Aug 23, 2012, 4:39 AM
mahi babuPosted Aug 23, 2012, 6:02 AM
very thank full to you . so use full your's code for me
thanks,
mahi
Dorababu MekaPosted Aug 23, 2012, 5:43 AM
@"(?<=\()(\d+)(?=\))"
Javeed M ShaikhPosted Aug 23, 2012, 4:46 AM