in reply to Re: array filter
in thread array filter

Thanks to all. I tried to use the suggested solutions, but it seems I have not well specified what I meant: the words included in @filter must match when they're not embedded in other words... Using the code above, when @filter meets a phrase in @main that contains, for example, "Ethernet", it strips out "the" and it returns "Ernet" , and that's not what I meant... Sorry if I was unclear.. I tried anyway to do :
for $filter (@filters) { s/\Q\b$filter\b\E//ig for @main; }
adding the \b bound delimiter, but still it doesn't work. How should I improve the regex to obtain what I need? Thank you again.

Replies are listed 'Best First'.
Re^3: array filter
by LanX (Saint) on Nov 18, 2008 at 11:39 UTC
    \b should be OK, but your escaping it within \Q and \E !!!

    Cheers LanX

    - - - - - Which song???

      ooops... Sorry, stupid me. Now it works! Thanks again for the help and... God bless the Monastery and all the Monks.
        > God bless the Monastery and all the Monks.

        Thx, but XP-whores like me prefer votes...

        hei honey, you had your pleasure ...now login and pay!!!

        *fg* LanX ; )

        - - - - - Which song???

        UPDATE: Sarcasm about the temple whores of the monastery gets downvoted? Funny, go on! *fg*
      oops... Stupid me! Sorry... Thanks again for all your kind help. God bless the Monastery and all the Monks.
Re^3: array filter
by LanX (Saint) on Nov 18, 2008 at 11:47 UTC
    > .. Sorry if I was unclear.. I

    no prob, a certain unclearity was obvious and the reason why I gave you a simple and expandable approach to start with. 8 )

    So, did you already think about the whitespaces left? ; )

    You may want to consider \s* instead of \b.

    When speed is a matter think about tuning the final solution like ikegami showed you!

    Cheers LanX

    - - - - - Which song???