Re: REGEX.Replace Question
From: David (dfoster_at_woofix.local.dom)
Date: 12/11/04
- Next message: W.G. Ryan eMVP: "Re: Snap-In GUI Example?"
- Previous message: Avi Dubnikov: "Re: Is there an event for image change for a PictureBox Control? p"
- In reply to: Robby: "Re: REGEX.Replace Question"
- Next in thread: Robby: "Re: REGEX.Replace Question"
- Reply: Robby: "Re: REGEX.Replace Question"
- Reply: Whitless: "Re: REGEX.Replace Question"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 10 Dec 2004 19:00:40 -0800
On 2004-12-11, Robby <edmund@not.my.email.com> wrote:
>
>
> It IS a bug.
No, it's not.
>
> We are not talking about string literals. We are talking about Regular
> Expression replace patterns.
Actually, we *are* talking about string literals. The second parameter
to the static Regex.Replace function is a regex pattern. But if you
look at the example again, the "\t" is in the third parameter, which is
NOT a regex pattern, it's a simple replacement string that allows only a
very few special characters, such as backreferences.
> The Regular Expression pattern "\t" is a [tab].
> So when you use "\t" in a Regular Expression replace pattern it should
> replace it with a [tab]. A Regular Expression find pattern of "\t" finds
> tabs in VB.Net.
Correct, but...
> According to pattern syntax a replace pattern of "\t"
> should insert [tab].
There's no such thing as a "replace pattern", at least not in the sense
that it's a regex pattern . What would that mean anyway? If you think
about it, you'll realize that there's no way the replacement string can
be a regex pattern.
e.g., what would you return for
Regex.Replace("1234", "123", "\w+\t\d+")
- Next message: W.G. Ryan eMVP: "Re: Snap-In GUI Example?"
- Previous message: Avi Dubnikov: "Re: Is there an event for image change for a PictureBox Control? p"
- In reply to: Robby: "Re: REGEX.Replace Question"
- Next in thread: Robby: "Re: REGEX.Replace Question"
- Reply: Robby: "Re: REGEX.Replace Question"
- Reply: Whitless: "Re: REGEX.Replace Question"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|