How to check a string starts with numeric value and ends with alphabets

Hi all could you please give the solution for checking the string is starts with numeric and ends with alphabets like

string=70.00 Lakshs or 10.00 Rupees or 0.9 REPEES the sting has any kind of alphabets like case sensitive or else upper case anything how can i check it

HI,

How about the following expression?

 System.Text.RegularExpressions.Regex.IsMatch(yourString,"^[-+]?\d[\d.,]*\b.*[A-Za-z]$")

Regards,

then how can i check the string starts with numeric and ends with numeric? @Yoichi kindly help me on this

Hey

give a try with

Regex.IsMatch(yourString, "^\d.*\d$")

Regards!

HI,

Do you mean numeric character or numeric value? (For example the former is “1ABC2”, the latter is “2 ABC 1”)

If the former, the following will work.

System.Text.RegularExpressions.Regex.IsMatch(yourString,"^\d.*\d$")

Regards,

2 Likes

like 0.90 or 70.00 or 70,000.00 or 10.00 like this

Hi,

Do we need to consider minus sign?
If not, the above will work.
If yes, the following might be better.

System.Text.RegularExpressions.Regex.IsMatch(yourString,"^[-+]?\d.*\d$")

Regards,

then how to check the string starts with alphabets and ends with alphabets @Yoichi kindly help me on this.

HI,

then how to check the string starts with alphabets and ends with alphabets

The following will work.

System.Text.RegularExpressions.Regex.IsMatch(yourString,"^[A-Za-z].*[A-Za-z]$")

Regards,

1 Like

how to check the string starts with alphabets and ends with numeric like @Yoichi kindly help me on this

Give it a try.

System.Text.RegularExpressions.Regex.IsMatch(yourString,"^[A-Za-z].*\d$")

Hi @Yoichi i need the string the text before the "

HI,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"ICIC\d+").Value

System.Text.RegularExpressions.Regex.Match(yourString,"\S+?@\S+?\.com",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Value

Regards,

hi @Yoichi i need the value which is in between "

The following returns string b/w Balance and Create. Can you try this?

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Balance).*?(?=Create)").Value

but the thing is i want the string starts from numeric value it is like 0.00 or else 70.00 or else 60,0000.00 like that

How about the following?

 System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Balance\D*)\d[.,\dA-Za-z]+(?=[^\dA-Za-z]*Create)").Value

Hi @Yoichi please compare the one which i am sending now and the earlier and give the expression for getting the string between “Balance” and the “Create” which is starting from the number and ends with alphabets or number and contains the the value is like “70.97 Lakhs” kindly help me on this

Can you try the following?

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Balance\D*)\d.*?[\dA-Za-z](?=[^\dA-Za-z]*Create)").Value

Try with this one @chandolusathi.kumar

System.Text.RegularExpressions.Regex.Match(yourString,"(?m)(?<=Balance)(.*?)(?=Create)").Value

Regards
Sudharsan