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 5970497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:22:57+00:00 2026-05-22T20:22:57+00:00

I have to check if these two url match a pattern (or 2, to

  • 0

I have to check if these two url match a pattern (or 2, to be more accurate). If so, I’d like to extract some portion of data.

1) /selector/en/any-string-chain-you-want.aspx?FamiId=32

Then I need to extract “en” and “32” into variables. To me the regex expression should like roughly something like /selector/{0}/any-string-chain-you-want.aspx?FamiId={1}

2) /selector/en/F/32/any-string-chain-you-want.html

where en and 32 must be assigned into variables. So:
/selector/{0}/F/{1}/any-string-chain-you-want.html

{0}: 2 letters language code such as en, fr, nl, es,…
{1}: family id integers (2 or 3 numbers) such as 12, 38, 124, etc but not 1212

Any idea on how to achieve it?

Thanks in advance,

Roland

  • 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-22T20:22:57+00:00Added an answer on May 22, 2026 at 8:22 pm

    This is the regex:

    /selector/([a-z]{2})/.+?\.aspx\?FamiId=([0-9]+)
    

    Code:

    var regex = new Regex(@"/selector/([a-z]{2})/.+?\.aspx\?FamiId=([0-9]+)");
    var test = "/selector/en/any-string-chain-you-want.aspx?FamiId=32";
    
    foreach (Match match in regex.Matches(test))
    {
        var lang = match.Groups[1].Value;
        var id = Convert.ToInt32(match.Groups[2].Value);
    
        Console.WriteLine("lang: {0}, id: {1}", lang, id);
    }
    

    Regex for second case: /selector/([a-z]{2})/F/([0-9]+)/.+?\.html (code doesn’t change)

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

Sidebar

Related Questions

I have to check some code and run it. I have the URL: svn+ssh://myuser@www.myclient.com/home/svn/project/trunk
Basically I have some code to check a specific directory to see if an
I would like to know how to merge these two Javascript ajax scripts. So
I have to check a number if it satisfies the following criteria: in binary,
I have a scenario where I have to check whether user has already opened
I have a control where I have to check in which page I am,
I have an app that needs to check a database table every minute. The
I have a winform app that calls a web service to check for updates.
I have written a DLL that uses MS Word to spell check the content
I have read the answers for What's the best way to check if a

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.