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

  • SEARCH
  • Home
  • 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 6357141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:06:31+00:00 2026-05-24T23:06:31+00:00

I need to write regex which I will use for asp.net routing constraint which

  • 0

I need to write regex which I will use for asp.net routing constraint which should match any word. The problem is that words could be written in any language, for example

  1. test
  2. some-other-test
  3. one-more-трудно-получить-result

Thx for 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-24T23:06:31+00:00Added an answer on May 24, 2026 at 11:06 pm

    If I’m understanding correctly, you want to match a url that has a word in it and pass that to your route, but the word could be in multiple languages.

    By default an Asp.net MVC Route will work with any language. For example a route like this:

    routes.MapRoute(
                    "Default", // Route name
                    "{controller}/{action}/{id}", // URL with parameters
                    new { controller = "Home", action = "Index", id = "" } 
                );
    

    Will match a url like “/controller/action/one-more-трудно-получить-result”. The ID parameter will hold the value “one-more-трудно-получить-result”.

    If you are looking to limit the route so it only matches words (no numbers) from any language then here is your regex:

    [\p{L}\p{M}-]+
    

    And here is how you would route this:

    routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = "default" },
                new { id = @"[\p{L}\p{M}-]+" }
            );
    

    The \p{L} will match any kind of letter from any language. The \p{M} will match any character intended to be combined with another character (e.g. accents, umlauts, enclosing boxes, etc.). This route will match a url like “/controller/action/one-more-трудно-получить-result” but not “/controller/action/one-more-трудно-по12341лучить-result”.

    Just an FYI the \p{N} is used to match any number, \p{P} is for punctuation, and \p{C} if for invisible control characters and unused code points.

    Resources:
    http://www.regular-expressions.info/unicode.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write a small regex which should match the occurrences of literal
I need to write a regex which will match URLs that do not have
I need to write a web application using SQL Server 2005, asp.net, and ado.net.
I need to write a regex which matches strings representing comma separated days of
I need write an update statement that used multiple tables to determine which rows
I need to write a program used internally where different users will have different
I need to write a rule to redirect any image file to a specific
I need help with a RegEx problem: I want to find occurences of two
I'm trying to write a regular expression which should be able to identify boolean
I'm trying to write a regex expression that will take this phrase [[32, 120],

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.