That's exactly what I couldn't find. Thanks!!
"ekkehard.horner" wrote:
Quote:
> Nick B schrieb: Quote:
> > Is there a way to use Replace with Regular Expressions but keep a character
> > in the original string? A simplified example: If we have "< a >" or "<b >"
> > or "< br>" within a string and we want to remove the spaces, but keep the
> > character, is there a way this can be done? A Regular Expression can find
> > the substring with something like "<\s*[a-z]\s*>" (only finds one character),
> > but the ReplaceWith argument appears to be static. Is there any way to keep
> > the character?
> [...]
> You can use $<n> (<n> = number of () in pattern starting with 1) in the
> replacement string:
>
> oRE.Pattern = "(<)(\s*)(\S+)(\s*)(>)"
> 1 2 3 4 5
> sRes = oRE.Replace( "< br >", "$1$3$5" )
>