#!/usr/bin/perl -w use strict; my $line = "Hello world [Pyruvate] [pyruvate]\n"; $line =~ s/\b(\w+)\b/\l$1/g; print $line; __END__ prints: hello world [pyruvate] [pyruvate]