[Bioperl-l] A perl regex query

Spiros Denaxas spiros at lokku.com
Tue Sep 18 12:56:44 UTC 2007


On 9/18/07, Sendu Bala <bix at sendu.me.uk> wrote:
> Spiros Denaxas wrote:
> > Its not impossibe, you just have to use \b to denote the word boundaries :)
> >
> > echo 'this-is-a_test-D-string-D' | perl -ne ' s/\b\-D\-\b//g ; print ;'
> >
> > this-is-a_teststring-D
> >
> > It only gets rid of -D- , all other occurrences of D and - remain intact.
>
> I'm confused. The simpler:
>
> echo 'this-is-a_test-D-string-D' | perl -ne ' s/-D-//g ; print ;'
>
> gives the same answer. You'd have to something very strange for a regex
> on -D- to match D or - alone.
>

Its the same thing. He was just mixing up character classes in the regex.

Spiros



More information about the Bioperl-l mailing list