in reply to Quick regexp question

Just a thought, your code is going to make things like "CIA" and "NASA" come out as "Cia" and "Nasa" -- is that OK?


($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print

Replies are listed 'Best First'.
Re: Re: Quick regexp question
by rkg (Hermit) on Oct 06, 2003 at 02:32 UTC
    Yep, imperfect, but it is the best I can do given the large volume of text I need to process, and meets the level of accuracy of the spec.


    <humor> Maybe perl 6 will offer new flavors of \b word boundary tags which'll be smart enough to recognize the start of well-know acronyms...</humor>

      You could always define a hash of any acronyms that are likely to be there (download a list from somewhere) and put "unless defined $dontchange{$word}" before your regex.


      ($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print