[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

regex-quote.c syntax support

From: Reuben Thomas
Subject: regex-quote.c syntax support
Date: Thu, 3 Mar 2011 23:57:25 +0000

regex-quote seems only to support two syntaxes at the moment, and it
does it in a rather odd way: by a single boolean flag.

I wonder if there's scope to change this.

The obvious representation of syntaxes from a GNU point of view would
be a bitmask of type reg_syntax_t as passed to re_set_syntax. This
would however add a dependency on the regex module.

An alternative would be to allow the caller to pass a string argument
containing the characters to be escaped, (plus an escape character?).
This would make the routine more flexible.

In the latter case one could also add a routine that translates a
reg_syntax_t into a string.

My particular desire is to be able to escape Emacs-syntax regexs, but
I can imagine other users wishing to escape Awk, grep, or other
syntaxes, in GNU or POSIX flavours. GNU's regex.h reveals these all to
be distinct.

By passing a string one could also escape PCRE syntax and others not
supported by regex.h, e.g. Lua regexs.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]