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
Coookie not storing information
How do I enable audio mapping over RDP on Windows 7?
System.FormatException:Dat
agridviewC
omboboxcel
l value is not valid
Counter and Timestamp in Excel
Emphasize an out of range value in Excel.
SBS2003 no http access just https
SharePoint - single user can't access Rich Text Editor
How to Setup Airport Extreme as DHCP Server on LAN with SonicWall
vb.net httpwebrequest timeout not working correctly
Excel treeview object