CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Text between { and }

 



PerlGuy
Novice

Nov 27, 2002, 5:42 AM

Post #1 of 2 (314 views)
Text between { and } Can't Post

Unsure HELP PLEASE

I need to extract the text between the following characters {,}.
For example: I have a text file where in the first line is the '{' . The next 3 lines contain the text I want to extract and at the end of the text is the '}'.
Sample text:
{
This is the 1st line
This is the 2nd line
}

How can I get the text between '{' and '}' ?

Thanks in advance for your help and apologies in advance if this matter has been posted/asked already.


Paul
Enthusiast

Nov 27, 2002, 7:25 AM

Post #2 of 2 (313 views)
Re: [PerlGuy] Text between { and } [In reply to] Can't Post


Code
my ($wanted) = $string =~ /{([^}]+)}/s;


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives