Search code examples
phpregexack

Ignoring characters in search with ack


I am using ack to search for instances of the PHP function "split(" that has now been deprecated. Unfortunately, it is bringing up instances of preg_split (which is still valid), how can I ignore these results, whilst still searching for "split("?

ack --type=php split\\\(

Thanks.


Solution

  • ack --type=php '[^_]split\('
    

    Since preg_split() has an underscore before the split, just use a negated match for the underscore.