Also, the regular expression is probably better written as:perl -e '(@x)=$ARGV[0]=~/\[(.*?)\]/g; print qq|$x[$#x];\n|' "enoyl-[a +cyl-carrier-protein] reductase [NADH] 2 [Silicibacter sp. TrichCH4B]. + " #--output--- Silicibacter sp. TrichCH4B;
(But that assumes matching "]" are guaranteed.)/\[([^\]]+)\]/
All great truths begin as blasphemies.
― George Bernard Shaw, writer, Nobel laureate (1856-1950)
In reply to Re: regular expression
by NetWallah
in thread regular expression
by ssharma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |