On Apr 15, 2004, at 6:22 PM, James Edward Gray II wrote:
On Apr 15, 2004, at 6:10 PM, [EMAIL PROTECTED] wrote:
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]
Maybe:
s/^[^[]]*\[([^[]]+)\][^[]]*$/$1/
Forgot a few backslashes there. Should be:
s/^[^\[\]]*\[([^\[\]]+)\][^\[\]]*$/$1/
James
Wow, that's plenty ugly.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>