Microsoft
Software
Hardware
Network
Question : Extract chars from a string using regex
Hi,
I have some strings like this:
1: Some Text
5-7 More Text
etc.
Now I like to extract the chars from these strings so I like to get thiese results:
1:
Some Text
5-7
More Text
What I tried was this (I don't really know RegEx):
string pattern = @"[A-Za-z]{1,}";
if (Regex.IsMatch(lead, pattern))
{
string[] dummy = Regex.Split(lead, pattern);
}
But the result will be '1:', ' ' and '' - not what I want :-)
So what is the right way to find the first char and get it till the end?
Thanks
Andre
Answer : Extract chars from a string using regex
Try:
Regex.Split(lead, "(?<=^\S+)\s");
Posted via EE Mobile
Random Solutions
GridView control scroll bars are not visible on page reload
Crystal cross-tab page numbering
setting text of a dynamic dom element using javascript
Scheduled Tasks to perform daily export of W2K3 server Event Viewer Logs.......
DAG & CAS array configured but it's not failover
Why does a SAV 10.2.4.4000 new installation show up as 10.1.9.9000?
Deploying SharePoint project to Production Server
How do I link combo boxes to select query in a form?
Cannot pull Data from Oracle using SSIS
Including fields in Filemaker email