Regular Expression Fail

Spotted on

Regular Expression Fail


Just as well they didn’t do a replace with something more appropriate.

Still, better call Perl to the rescue:

   perl -i -pe 's/(\b$filteredWords\b)/XXX/gxis' content.txt
This entry was posted in IT. Bookmark the permalink.

4 Responses to Regular Expression Fail

  1. David says:

    Looking at retiring and spending your assets already?

    BTW: I was wrong in thinking an ass was half horse, should have said mule.

  2. michelle says:

    Need to convince the bank of this first…

    Oh, so it should be ‘Spending Financial Mulets’?

  3. David says:

    Only if you own a horse

  4. Ian says:

    \b is your friend. A pity that sorted’s web developer hasn’t met it yet.

Leave a Reply

Your email address will not be published.