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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:46:57+00:00 2026-05-26T15:46:57+00:00

I have the following JSON: validate = { ‘(\\.org|\\.info|\\.biz|\\.name)$’: [ { ‘type’: ‘size’, ‘pattern’:

  • 0

I have the following JSON:

validate = {
    '(\\.org|\\.info|\\.biz|\\.name)$': [
        { 'type': 'size', 'pattern': /^.{3,64}$/, 'error': 'Your domain can have at max 26 characters and at least 3.' }
    ],
    '.*': [
        { 'type': 'general', 'pattern': /^[^\.-].*[^\.-]$/, 'message': 'Your domain name shouldn\'t contain . or - at the beginning or the end.' },
        { 'type': 'characters', 'pattern': /^[abcdefghijklmnopqrstwuvxyz0123456789]+$/, 'error': 'Your domain can have at max 26 characters and at least 3.' }
    ]
};

and tried to use like this:

var validate = new Dictionary<string, dynamic> {
    {
        @"(\.org|\.info|\.biz|\.name)$",
        new {
            Type = "size",
            Pattern = @"^.{3,64}$",
            Message = "Your domain can have at max 26 characters and at least 3."
        }
    }
};

Where the key of the dynamic object its the regex pattern for the domain extension and the regex inside Pattern key its the one that should match the domain name.

But I can’t figure out how I put 2 validations type inside the dynamic part of the Dictionary.

Has anyone did anything like it before or it’s stupid and I should do in another way?

The point of doing it this way it’s that I can serialize the dictionary as a Json.

  • 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-26T15:46:57+00:00Added an answer on May 26, 2026 at 3:46 pm

    I tried with a List<dynamic> at the dynamic part of my Dictionary:

    var validate = new Dictionary<string, List<dynamic>> {
        {
            "(\\.org|\\.info|\\.biz|\\.name)$",
            new List<dynamic>
            {
                new {
                    Type = "size",
                    Pattern = @"^.{3,64}$",
                    Message = "Your domain can have at max 26 characters and at least 3."
                }
            }
        },
        {
            ".*",
            new List<dynamic>
            {
                new {
                    Type = "general",
                    Pattern = @"^[^\.-].*[^\.-]$",
                    Message = "Your domain name shouldn\'t contain . or - at the beginning or the end."
                },
                new {
                    Type = "characters",
                    Pattern = @"^[abcdefghijklmnopqrstwuvxyz0123456789]+$",
                    Message = "Your domain name should contain only alphanumeric characters."
                }
            }
        }
    };
    

    And using Json from JsonResult mvc3 view it returned the json I needed.

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

Sidebar

Related Questions

I have follwing JSON: {mykey:[{name:Jak,interests:movies}]} and following opensocial app code: <script type=text/os-template require=mykey> <ul>
I have the following Json : {\doc\:{\info\:{\allowDistribution\:\true\,\allowSearch\:\true\,\calaisRequestID\:\67a02f61-7e45-cfc4-1276-e123c5f7422f\,\externalID\:\\,\id\:\ http://id.opencalais.com/dBo1YRiQeqS-kfO-m9UeWA \,\docId\:\ http://d.opencalais.com/dochash-1/8edabb36-eece-3f67-b187-ab64cd885ecb \,\document\:\What type of music
I have the following javascript: $.ajax({ type: "POST", dataType: "json", url: "/Home/Submit", data: {
I have an json output of the following (ignore the escape characters) {\sEcho\:1,\iTotalRecords\:10,\iTotalDisplayRecords\:10,\aaData\:[{\Job\:\developer\,\Name\:\kurt\},{\Job\:\plumber\,\Name\:\john\}]} which
I have the following JSON: {workspace: { name:Dallas, dataStores:http://.....:8080/geoserver/rest/workspaces/Dallas/datastores.json, coverageStores:http://.....:8080/geoserver/rest/workspaces/Dallas/coveragestores.json, wmsStores:http://....:8080/geoserver/rest/workspaces/Dallas/wmsstores.json}} And I´m trying
I have the following json string: {response:[[{uid:123456,name:LA_}],[{cid:1,name:Something}],[{cid:1,name:Something-else}]]} How can I get Something value? I
I have the following JSON file as input, { $type: NanoWebInterpreter.WebInputData, NanoWebInterpreter, NBBList: {
I have the following json output when i call a sample webservice <string>[{Name:Ajay Singh,Company:Birlasoft
I have following JSON for sending request on server { name:Home, latitude:45.5037078163837, longitude:-122.622699737549, radius:240
I have the following json-formatted data: {mydata: [{phone:5456868,name:Dave},{phone:9999875,name:Susan}, {phone:9994058,name:Mary},{phone:9995658,name:Jan}, {phone:3584650,name:Yanni},{phone:4512523,name:Wendy}, {phone:6595959,name:Jaime}]} I'd like to

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.