[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RegExp.Replace


Yes, I read the documentation, but when you're tackling a subject 
you're unfamiliar with, it's easy to get lost. 
Everything isn't necessarily clear when you're starting a new topic.

strResult = regExpression.Replace(strSource, "\\s+", " ", regExpression.Greedy)
Indeed, it works like that.

Thank you for your help. 
 Sincerely





Le mardi 02 décembre 2025 à 11:28 +0100, Benoît Minisini a écrit :
> Le 02/12/2025 à 08:13, CD a écrit :
> > Hello,
> > 
> > I have a string like this:
> > 
> > Dim s As String = "A     B    C D   E"
> > 
> > s = RegExp.Replace(s, "\\s+", " ")
> > 
> > Print s
> > 
> > I would like to get "A B C D E"
> > 
> > What should I write in the Pattern string?
> > I've tried many things, without success.
> > So what should I change to get the desired result?
> > 
> > Regards
> > 
> 
> You must use the 'RegExp.Greedy' compilation option, otherwise '\\s+' 
> only matches one space.
> 
> Regards,
> 


Follow-Ups:
Re: RegExp.ReplaceBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
References:
RegExp.ReplaceCD <dessere.claude@xxxxxx>
Re: RegExp.ReplaceBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>