Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > matching curly braces and regular expressions

Reply
Thread Tools

matching curly braces and regular expressions

 
 
Dustin D.
Guest
Posts: n/a
 
      08-26-2003
Let's say I have a text file with the following:

food {
fruits {
apples
oranges
pears
}
dairy {
ice_cream {
chocolate
vanilla
}
milk
}
}

I want to use a regular expression to crop out the "dairy" section.
That is, I want to find the word dairy and count the curly braces, and
using this, crop out a part of a file.

Is there an easy way to do this with regular expressions? I wrote a
function that counts letters and so forth, but it's not full-proof and
has some problems.

Thanks,
Dustin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing Strings in Enclosed in Curly Braces xamalek@yahoo.com Python 10 05-17-2009 12:14 AM
Macro substitution: curly braces behaviour? TJ C Programming 5 02-14-2007 11:49 AM
XMLHTTP: translating entities like curly quotes and curly apostrophes? Ken Fine ASP General 2 02-24-2004 11:17 AM
...curly problem for a curly guru philpot Computer Support 5 11-29-2003 12:02 PM
AVT / Curly braces : why don't they work for me ? Geathaa XML 1 09-12-2003 01:35 PM



Advertisments