[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: rx.el sexp regexp syntax
From: |
Drew Adams |
Subject: |
RE: rx.el sexp regexp syntax |
Date: |
Sun, 3 Jun 2018 12:57:57 -0700 (PDT) |
It's not just about confusion/obscurity due to the "extra"
backslashes (for `(', `)', and `|'). It's also about the
fact that regexps themselves can be complicated. For
example, `directory-listing-before-filename-regexp':
"\\([0-9][BkKMGTPEZY]? \\(\\([0-9][0-9][0-9][0-9]-\\)?[01][0-9]-[0-3][0-9][ T][
0-2][0-9][:.][0-5][0-9]\\(:[0-6][0-9]\\([.,][0-9]+\\)?\\(
?[-+][0-2][0-9][0-5][0-9]\\)?\\)?\\|[0-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]\\)\\|.*[0-9][BkKMGTPEZY]?
\\(\\(\\([A-Za-z']\\|[^\0-]\\)\\([A-Za-z']\\|[^\0-]\\)+\\.? +[ 0-3][0-9]\\|[
0-3][0-9]\\.? \\([A-Za-z']\\|[^\0-]\\)\\([A-Za-z']\\|[^\0-]\\)+\\.?\\) +\\([
0-2][0-9][:.][0-5][0-9]\\|[0-9][0-9][0-9][0-9]\\)\\|\\([A-Za-z']\\|[^\0-]\\)\\([A-Za-z']\\|[^\0-]\\)+\\.?
+[ 0-3][0-9], +[0-9][0-9][0-9][0-9]\\|\\([ 0-1]?[0-9]\\([A-Za-z]\\|[^\0-]\\)?
[ 0-3][0-9]\\([A-Za-z]\\|[^\0-]\\)? +\\|[ 0-3][0-9] [ 0-1]?[0-9] +\\)\\([
0-2][0-9][:.][0-5][0-9]\\|[0-9][0-9][0-9][0-9]\\([A-Za-z]\\|[^\0-]\\)?\\)\\)\\)
+"
Even after removing "extra" backslashes, it's still a bear:
"([0-9][BkKMGTPEZY]? (([0-9][0-9][0-9][0-9]-)?[01][0-9]-[0-3][0-9][ T][
0-2][0-9][:.][0-5][0-9](:[0-6][0-9]([.,][0-9]+)?(
?[-+][0-2][0-9][0-5][0-9])?)?|[0-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9])|.*[0-9][BkKMGTPEZY]?
((([A-Za-z']|[^\0-])([A-Za-z']|[^\0-])+\\.? +[ 0-3][0-9]|[ 0-3][0-9]\\.?
([A-Za-z']|[^\0-])([A-Za-z']|[^\0-])+\\.?) +([
0-2][0-9][:.][0-5][0-9]|[0-9][0-9][0-9][0-9])|([A-Za-z']|[^\0-])([A-Za-z']|[^\0-])+\\.?
+[ 0-3][0-9], +[0-9][0-9][0-9][0-9]|([ 0-1]?[0-9]([A-Za-z]|[^\0-])? [
0-3][0-9]([A-Za-z]|[^\0-])? +|[ 0-3][0-9] [ 0-1]?[0-9] +)([
0-2][0-9][:.][0-5][0-9]|[0-9][0-9][0-9][0-9]([A-Za-z]|[^\0-])?))) +"
As I said before:
> Functions that transform a regexp string to an RX
> sexp and vice versa would be very helpful.
(And yes, the latter exists.)
Ideally, we'd have the ability to put your cursor on
a regexp in some code and hit a key to:
* see a corresponding `rx' sexp and
* optionally replace the regexp with the `rx' sexp.
Just being able to see the `rx' sexp that corresponds
to a regexp in some code (even temporarily in a popup)
could help, I think.
- Re: rx.el sexp regexp syntax, Eric Abrahamsen, 2018/06/02
- Re: rx.el sexp regexp syntax, Stefan Monnier, 2018/06/02
- Re: rx.el sexp regexp syntax, Eric Abrahamsen, 2018/06/03
- Re: rx.el sexp regexp syntax, Helmut Eller, 2018/06/03
- Re: rx.el sexp regexp syntax, Eric Abrahamsen, 2018/06/03
- Re: rx.el sexp regexp syntax, Helmut Eller, 2018/06/03
- Re: rx.el sexp regexp syntax, Eric Abrahamsen, 2018/06/03
- RE: rx.el sexp regexp syntax,
Drew Adams <=
- Re: rx.el sexp regexp syntax, Eric Abrahamsen, 2018/06/03
- RE: rx.el sexp regexp syntax, Drew Adams, 2018/06/03
- Re: rx.el sexp regexp syntax, Stefan Monnier, 2018/06/04
- RE: rx.el sexp regexp syntax, Drew Adams, 2018/06/04
- Re: rx.el sexp regexp syntax, Pierre Neidhardt, 2018/06/04