The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Select everything between curly brackets

  • # January 18, 2009 at 6:03 am

    I want to match any code that is between two curly brackets.

    lorem ipsum {loriipsu} lorem ipsum…

    I’ve got no further markup.
    I think it has to be done with :before and :after but I don’t get it yet.

    # January 18, 2009 at 11:15 pm

    Within what languages are you using jquery? is this a form submission (php)? or you looking straight up xhtml/css?

    # January 20, 2009 at 7:01 am

    I think you need to read more about regular expressions. Then create pattern of selecting the inner content of braces. If we talk about JavaScript it will look like:

    < !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "">

    Untitled Document

    In a sample above /{[^}]+}/ is a pattern that selects everything inside of curly braces. g is activating the returning of array of found matches. Without it only the first match will be returned.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed