I think that this is what you need: /\[[\w]+\]/

This little application might help you (not sure if it is 100% Ruby
compatible, but may be a start) called TestRexp, which you can get
here: http://regexpstudio.com/RegExpStudio.html

hth,
Douglas


On Tue, 18 Jan 2005 06:20:43 +0900, trans.  (T. Onoma)
<transami / runbox.com> wrote:
> Let me painfully honest: I hate parsing, especially w/ regexp, and I don't
> care if it's because I stupid and suck at it. It shouldn't have to be this
> hair pulling! Anyway... Can some one please give the regular expression to
> match the first square bracket's contents. In this case it would be "Hello".
> 
> s = <<-EOS
> [Hello]
> This [b]is[b.] a test.
> [Hello.]
> EOS
> 
> Much obliged,
> T.
> 
>