.NETGURU
Not having word more than 50 characters...
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.

Post a new message to this list...

Amith Singh
Hello All,
I am using .Net Framework 1.1.
Using Regular Expressions I would like to split a word(inserting a blank
space) in a string if the word is more than N(say 50) characters. I can do
the same using string manipulations. I am just curious using regular
expressions it should be fast and less number of statements.
Thanks,
Amith

Reply to this message...
 
    
Kevin Spencer
Regular Expressions is not particularly useful in this situation. It's
really a matter of building a new string by using Substring on the original,
and concatenating the portions together.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Amith Singh" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Karl
Kevin,
Why would you say regular expressions aren't particularly useful? I think
part of the problem is what's being done isn't well explained. This is the
3rd time Amith has asked and each time we get slightly more information. I
agree with you that if you have a single word in a string string x = "blah"
then substring makes sense. But I'm ASSuming that we are talking about
large text fields...in which case I think regular expressions are the right
way (maybe not the only one) to go...

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/

"Kevin Spencer" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Kevin Spencer
> Why would you say regular expressions aren't particularly useful?

I did say "in this situation." I use Regular Expressions "regularly."

However, if you think using Regular Expressions in this case is a good idea,
go ahead and post your solution. :)

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Karl
I did in one of the previous threads Amith started asking the same question
:P

but here it is again:

Regex r = new Regex(@"(?<string>\S{50})", RegexOptions.Compiled
|RegexOptions.Multiline | RegexOptions.ExplicitCapture);
string newString = r.Replace(YOURSTRINGHERE, "${string} ");

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Kevin Spencer" <Click here to reveal e-mail address> wrote in message
news:e5ch5$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Text.RegularExpressions.Regex
System.Text.RegularExpressions.RegexOptions




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification