Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6589393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:10:08+00:00 2026-05-25T17:10:08+00:00

Using ASP.NET, and trying to implement friendly url re-writing but I’m having a heck

  • 0

Using ASP.NET, and trying to implement friendly url re-writing but I’m having a heck of a time working with the regular expression. Basically, I’m checking the url directly following the domain to see whether it is using the french-canadian culture, or whether it is a number – and not a number followed by characters. I need to catch anything that begins with ‘fr-ca’ OR a number, and both scenarios can have a trailing ‘/’ (forward slash), but that’s all…

fr-ca – GOOD
fr-ca/ – GOOD
fr-ca/625 – GOOD
fr-ca/gd – BAD
fr-ca43/ – BAD

1234 – GOOD
1234/ – GOOD
1234/g – GOOD
1234g – BAD
1g34 – BAD

This is what I’ve come up with : ^(fr-ca)?/?([0-9]+)?
But it doesn’t seem to be working the way I want.. so I started fresh and came up with (^fr-ca)|(^[0-9]), which still isn’t working the way I want. Please…HELP!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:10:08+00:00Added an answer on May 25, 2026 at 5:10 pm

    no idea about Asp.net, but the regexp was tested with grep. you could try in your .net box:

    kent$  cat a
    fr-ca
    fr-ca/
    fr-ca/625
    fr-ca/gd
    fr-ca43/
    1234
    1234/
    1234/g
    1234g
    1g34
    

    updated

    kent$  grep -P "(^fr-ca$|^\d+$|^(fr-ca|\d+)/(\w|\d*)$)" a
    fr-ca
    fr-ca/
    fr-ca/625
    1234
    1234/
    1234/g
    

    —

    well this may not be the best regex, but would be the most straightforward one.

    it matchs string

    ^fr-ca$
    or ^\d+$
    or ^(fr-ca|\d+)/(\w|\d*)$
    
    the above line can be broken down as well
      ^(fr-ca|\d+)/(\w|\d*)$ :
    
    starting with fr-ca or \d+
    then comes "/"
    after "/" we expect \w or \d*
    then $(end)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement a paging and sorting list in ASP.NET MVC without using
I'm developing an asp.net (classic) application trying to implement the MVP pattern using this
I'm trying to implement a simple ActionLink that will delete records using ASP.NET MVC.
I am trying to implement a RESTful MVC project using C# and ASP.Net, accordingly
I'm trying to implement exception handling in ASP.NET MVC3 using the HandleError attribute. The
I am trying to implement Url routing in asp.net 4.0. I just a created
I'm building a calendar in ASP.NET using Jquery, And I'm trying to implement Print.
I'm trying to create a simple CalDav server using ASP.NET MVC 3, but the
I'm trying to implement a remember me feature using ASP.NET MVC. It uses a
Im trying to implement an asp.net textbox using the jQuery UI Autocomplete widget http://jqueryui.com/demos/autocomplete/#remote

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.