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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:59:37+00:00 2026-06-14T17:59:37+00:00

I would like to match string like this with regEx: @media only screen and

  • 0

I would like to match string like this with regEx:

@media only screen and (max-width: 479px){
.abv{style:value;style:value}
.xyz{style:value;style:value}

}

but somehow I cant.
My regEx start with / @media[^{]*\{ /gim
then a want to match everything except }} folow by }}
/@media[^{]*\{[^}}]*\}(?=})/gim -this is not working because [^}}] == [^}] … I have no idea how to make regEx working like this 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-06-14T17:59:38+00:00Added an answer on June 14, 2026 at 5:59 pm

    You want this:

    /@media[^{]*\{(?:(?!\}\s*\}).)*/gis
    

    See it here on Regexr

    1. You don’t need the m modifier, it works only on the anchors ^ and $

    2. You meant the s modifier to make the . match also newline characters. You didn’t use the . in your regex, but I did.

    3. What you want to achieve is possible with this construct (?:(?!\}\s*\}).)* it means match the next character only if it is not a } followed by another } with possibly whitespace in between. This assertion is ensured by the negative lookahead (?!\}\s*\}). The group starting with ?: is only a non capturing group, nothing special.

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

Sidebar

Related Questions

I would like to regex match a sequence of bytes when the string '02
I'm trying to make a regex that would match this string: asf, Algeria, Wilaya
I have a string: var doi_id= 10.3390/metabo1010001 And I would like to match only
I would like 'about' to route to 'abouts/1' I tried this: match 'about' =>
Possible Duplicate: RegEx match open tags except XHTML self-contained tags I would like tu
I would like to be able to match a string literal with the option
I am looking to match a string like this: [quote12445555=Me]Some \n Quote[/quote12445555] And replace
I have a string: [{id:1,gameName:arizona,cost:0.5E1,email:hi@gmail.com,requests:0},{id:2,gameName:arizona,cost:0.5E1,email:hi@gmail.com,requests:0},{id:3,gameName:arizona,cost:0.5E1,email:hi@gmail.com,requests:0}] However, I would like to parse this string into
How would I match the string contained inside these brackets using regex? [youtubehd:JqIrKJ1Q1nz] I
I would like to match any character and any whitespace except comma with regex.

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.