[Bioperl-l] A perl regex query

Sendu Bala bix at sendu.me.uk
Tue Sep 18 08:53:34 EDT 2007

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.

More information about the Bioperl-l mailing list