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
How do I write data to separate excel worksheets in coldfusion?
How do I charge for a job?
onClick toggle function
Coldfusion - SQL syntax
URGENT - SBS 2008 No primary network adapter found
Windows7 my Documents folder
IE8 Submit Form with [Enter] Key, not functioning properly
intrusion.generic.tcp.flag
s.bad.comb
ine.attack
Why won't Exchange Transport service start in Exchange 2007 on our SBS 2008 server ?
instantiating an object in php