Re: Regex Help!

2004-03-21 Thread Wiggins d'Anconia
Sara wrote: I am looking for a regex which would extract the intials from a string i.e. str = "Doe, John L.L.M"; $str =~ /(^(\w)).*?((\s)(\w)).*?((\s)(\w))/; $initial = $1.$2.$3; print "$initial"; The above code is not serving my purpose. String constants: There would be always 3 words (obviou

Regex Help!

2004-03-21 Thread Sara
I am looking for a regex which would extract the intials from a string i.e. str = "Doe, John L.L.M"; $str =~ /(^(\w)).*?((\s)(\w)).*?((\s)(\w))/; $initial = $1.$2.$3; print "$initial"; The above code is not serving my purpose. String constants: There would be always 3 words (obvioulsy with 2