Hi,
Eg : I have string value - 2M Fairview Hospital
From this string I would need to extract only characters like - M Fairview Hospital
I am using the attached regex format but, it’s giving me the null value…not sure why…Can anyone help me with this…
System.Text.RegularExpressions.Regex.Match(StrOrgname,“[A-Z a-z]*”).ToString
Thanks,
Divya.
Gokul001
(Gokul Balaji)
November 30, 2022, 3:00pm
2
Hi @divya.x.kuchi
How about this expression
System.Text.RegularExpressions.Regex.Match(YourString,"\D.*").Tostring
1 Like
Anil_G
(Anil Gorthi)
November 30, 2022, 3:00pm
3
divya.x.kuchi:
2M Fairview Hospital
Hi @divya.x.kuchi
Please use this regex \D.+
\D is for excluding numbers
cheers
Gokul001
(Gokul Balaji)
November 30, 2022, 3:01pm
4
This is the result @divya.x.kuchi
Regards
Gokul
Gokul001
(Gokul Balaji)
November 30, 2022, 3:04pm
5
You need to use .*
System.Text.RegularExpressions.Regex.Match(StrOrgname,“[A-Z a-z].*”).ToString
You can see the different in the image
Result
Regards
Gokul
Gokul001:
\D.*
Hi Gokul,
Thanks for the help. What expression should i use to match only numbers?
Gokul001
(Gokul Balaji)
November 30, 2022, 3:14pm
7
HI @divya.x.kuchi
System.Text.RegularExpressions.Regex.Match(StrOrgname,“\d+”).ToString
Yoichi
(Yoichi)
November 30, 2022, 3:17pm
8
Hi,
FYI, because you use [A-Z a-z]*
and it matches empty string just before 2. (*
means 0 or more)
So [A-Z a-z]+
will work as you expect. (+
means 1 or more)
Regards,
system
(system)
Closed
December 3, 2022, 3:17pm
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.