Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegEx and ASP.NET

Status
Not open for further replies.
Jun 9, 2006
159
US
I'm trying to create a reg ex expression for a URL rewriting .net handler that will find user names that precede a web url and redirect them based off their ID to a certain page. Example:


The regex expression should look for a string that doesn't have an extension I guess. Here is the code that parses the regex:


Code:
public string GetSubstitution(string zPath) 
{
    Regex oReg;

    foreach(XmlNode oNode in _oRules.SelectNodes("rule")) {
        oReg=new Regex(oNode.SelectSingleNode("url/text()").Value);
        Match oMatch=oReg.Match(zPath);

        if(oMatch.Success) {
            return oReg.Replace(zPath,
                             oNode.SelectSingleNode("rewrite/text()").Value);
        }
    }

    return zPath;
}

Can you help write this expression?

Thanks!

Shawn Molloy
Seattle, WA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top