Hi all,
I'm attempting to create a custom regex expression in ASP.Net and could use a little help.
I need to create a Regex to rewrite the URL’s in the /profiles/ section of my WorkoutBOX the site. Here are some examples of what I need done:
Rewrite from:
www.workoutbox.com/profiles/sampleusername
www.workoutbox.com/profiles/simonturner
To:
www.workoutbox.com/profiles/username/sampleusername
www.workoutbox.com/profiles/username/simonturner
NB - "/username/" is just a static string and does not mean the username of a logged on user.
I'm working with a custom URL Rewriting tool that accepts a lookFor regex and a rewriteTo regex. Here is the entry in the config file where i need to put the regex's:
<parameterRewrite name="ProfileRewrite" tabNames="Profiles" lookFor="" rewriteTo="" />
Here's an example of a working set of regex's to rewrite a custom URL:
<!-- this rule is for rewriting ventrian news articles from a format of /2/article-name where '2' is the article id, and 'article-name' is the SEO name generated by the NA module -->
<parameterRewrite name="ventrian news articles" tabNames="Articles;Products" lookFor="(?<!articletype/articleview/articleid)(?:/|^)(?<artid>\d+)/(?<artname>[^&][\w\d-]+)" rewriteTo="articletype=articleView&articleId=$1&$2" />
Would really appreciate some help on this one, I'm a pretty decent programmer but have absolutly no idea when it comes to regular expressions.
Thanks again,
Simon Turner