Grow your CSS skills. Land your dream job.

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:

    Code:
    < !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">







    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.

*May or may not contain any actual "CSS" or "Tricks".