Hi Omer,

On Mon, Jul 20, 2015 at 9:46 PM, Omer Zak <w...@zak.co.il> wrote:

> Instead of creating a separate bgrep, it would have been better to be
> able to extend the syntax of regular expressions (in egrep, Perl and
> other platforms) to allow specification of binary strings having
> arbitrary length by means of an hex string.
>
> This would come instead of making it very cumbersome to specify strings
> longer than one character (\xnn or \unnnn or equivalent - see also:
> http://www.regular-expressions.info/unicode.html).
>
>
Well, you can already match binary sub-strings inside Perl regular
expressions using the method you describe (\xHH\xHH\xHH . etc.) In Perl
you can do something like:

my $bin_string = [Binary string generated by whatever means necesary]

if ($haystack =~ / ... \Q$bin_string\E ... /)
{
}

So given the rarity of matching binary strings, it seems like a good
compromise.

And if we are at it, it would have been nice to add to all R.E. engines
> hooks to allow private extensions of R.E. syntax, in order to allow
> people to concisely express special parsing requirements.
>
>
Recent versions of perl 5 allow you to use different (and possibly custom)
regular expression engines.

Regards,

-- Shlomi



> --- Omer
>
>
-- 
------------------------------------------
Shlomi Fish http://www.shlomifish.org/

Chuck Norris helps the gods that help themselves.

Please reply to list if it's a mailing list post - http://shlom.in/reply .
_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

Reply via email to