in reply to Parsing spaces and curly braces

If you don't have to worry about nesting braces, you can extract the strings like so:
@matches = /(\{[^}]+\}|\S+)/g;

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: Parsing spaces and curly braces
by ikegami (Patriarch) on Sep 12, 2005 at 20:09 UTC

    Cases not specified by the OP behave as follows:

    "xxx{yyy zzz}" is split into "xxx{yyy" and "zzz}".
    "{xxx yyy}zzz" is split into "{xxx yyy}" and "zzz".

    @matches = /({[^}]+}|[^{\s]+)/g; might work better:

    "xxx{yyy zzz}" is split into "xxx" and "{yyy zzz}".
    "{xxx yyy}zzz" is split into "{xxx yyy}" and "zzz".

Re^2: Parsing spaces and curly braces
by cochrasc (Initiate) on Sep 12, 2005 at 19:58 UTC
    That did it...thanks, Roy.