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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:55:58+00:00 2026-06-17T10:55:58+00:00

I have this json file. Part of it is given below : { has_more

  • 0

I have this json file. Part of it is given below :

{ "has_more" : false,
  "items" : [ { "aliases" : [ "http://www.stackoverflow.com" ],
        "api_site_parameter" : "stackoverflow",
        "markdown_extensions" : [ "Prettify" ],
        "name" : "Stack Overflow",
        "related_sites" : [ { "name" : "Stack Overflow Chat",
              "relation" : "chat",
              "site_url" : "http://chat.stackoverflow.com"
            } ],
        "site_state" : "normal",
        "site_type" : "main_site",
        "site_url" : "http://stackoverflow.com",
        "styling" : { "link_color" : "#0077CC",
            "tag_background_color" : "#E0EAF1",
            "tag_foreground_color" : "#3E6D8E"
          }
      },
      { "api_site_parameter" : "serverfault",
        "markdown_extensions" : [ "Prettify" ],
        "name" : "Server Fault",
        "related_sites" : [ { "api_site_parameter" : "meta.serverfault",
              "name" : "Meta Server Fault",
              "relation" : "meta",
              "site_url" : "http://meta.serverfault.com"
            },
            { "name" : "Chat Stack Exchange",
              "relation" : "chat",
              "site_url" : "http://chat.stackexchange.com"
            }
          ],
        "site_state" : "normal",
        "site_type" : "main_site",
        "site_url" : "http://serverfault.com",
        "styling" : { "link_color" : "#10456A",

I want to match strings like

        "related_sites" : [ { "name" : "Stack Overflow Chat",
              "relation" : "chat",
              "site_url" : "http://chat.stackoverflow.com"
            } ],

and

        "related_sites" : [ { "api_site_parameter" : "meta.serverfault",
              "name" : "Meta Server Fault",
              "relation" : "meta",
              "site_url" : "http://meta.serverfault.com"
            },
            { "name" : "Chat Stack Exchange",
              "relation" : "chat",
              "site_url" : "http://chat.stackexchange.com"
            }
          ],

without enabling multiline. Any idea how to do that?

  • 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-06-17T10:55:59+00:00Added an answer on June 17, 2026 at 10:55 am

    “Enabling multiline” is exactly how you match multiple lines. That’s why it’s called “multiline”. But since all it does is change . to include \n, you could just write (.|\n) instead.

    But given that this is JSON, why on earth are you using a regex on it? Just parse it to a data structure and work from there.

    data = json.loads(json_string)
    for item in data['items']:
        print item['related_sites']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this JSON http://www.progmic.com/ielts/retrive.php that I need to parse. When I do it
I have in some file contains this json part (from FACEBOOK API): --- !seq:Koala::Facebook::API::GraphCollection
I have a JSON file which contains a pound symbol in it. This json
I have this swf (flash) file that provides the json that needs to be
I have a json file exported from phpmyadmin, it looks like this(utf-8 file): [{user_email:
I have some data and need to create a json file with this structure
I have a JSON data file that is part of my application (version controlled,
This is the jquery ajax part in which i have sent json data to
This is part of my JSON file I obtain through the twitter API: text:Scientists
I have this simple json file in my iphone/ipad project. {initial_page : Page_Selected} Page_Selected

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.