🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #654

Regular Expression mystery

#654
From: John Fowler
Date: Wed, 15 Sep 2004 04:12
17 lines
1502 bytes
Could someone please enlighten me?

In the following regex, what does the '/' in [^/] mean and what does the  '?/' at the end of the string mean?

Regex r = new Regex(@"^(?<proto>\w+)://[^/]+?(?<port>:\d+)?/" etc.

Similarly, this Regular Expression is used to replace invalid characters, EXCEPT "." and "@" and "-" but my reading of it is that it replaces (beginning from the left side, as specified by the "^" ) all word-length characters ( the "\w" ) and the "\", ".", "@" and "-" characters as well.

// Replace invalid characters with empty strings.
        return Regex.Replace(strIn, @"[^\w\.@-]", "");

What am I missing?

Thanks for any and all help!

John F.
Technical Details
Message-ID: <4147c11f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!proxad.net!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,d9c3806e5dda49d9,start
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "John Fowler" <jfowelr@p*o*l*.net>
Sender: "John Fowler" <jfowelr@p*o*l*.net>
Reply-To: "John Fowler" <jfowelr@p*o*l*.net>
Subject: Regular Expression mystery
Newsgroups: borland.public.csharpbuilder.language.csharp
X-User-Info: 24.20.189.226     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4147c11f$1@newsgroups.borland.com>
Date: 14 Sep 2004 21:12:15 -0700
X-Trace: newsgroups.borland.com 1095221535 207.105.83.66 (14 Sep 2004 21:12:15 -0700)
Lines: 20
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!proxad.net!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail