Try this...

# untested
$text =~ s/\[[^\]]+?\]/$1/g;

[^\]] - means anything but a closing bracket
+? - means 1 or more times (as few as possible)

Rob

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 7:11 PM
To: [EMAIL PROTECTED]
Subject: Simple regex


How can I write a regular expression to keep the part of a string that's
between a pair of square braces?  Here's a sample line:

Updating Wellbore Set Keys: [wlbr_id = 1234567890, data_provider_code =
MTBL, welltype = OIL]

Thanks in advance for your help!

Scott

Scott E. Robinson
SWAT Team
Data Mgt Practices & Operations (DMPO)
RR-690 -- 281-654-5169
EMB-2813N -- 713-656-3629


Safe today - here tomorrow


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to