[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?
From: |
tomas |
Subject: |
Re: How to get a concatenation of the negations with rx (ex: [^a][^b])? |
Date: |
Mon, 13 Nov 2023 20:26:06 +0100 |
On Sat, Nov 11, 2023 at 10:00:12PM +0100, Emanuel Berg wrote:
> Edgar Lux wrote:
>
> > Hello. I am trying to get this regular expression:
> >
> > "[^a][^b]"
> >
> > in an easier way. I thought that I could do
> >
> > (rx (not (seq "a" "b")))
> >
> > but that got me
> >
> > Debugger entered--Lisp error: (error "Illegal argument
> > to rx ‘not’: (seq \"a\" \"b\")")
> >
> > The error is very clear, but I would like to know if there
> > is a smart way of achieving the same without having to type:
> >
> > (rx (seq (not "a") (not "b")))
> >
> > which produces
> >
> > "[^a][^b]"
>
> (rx (not (any "a" "b")))
>
> "[^ab]"
(string-match "[^a][^b]" "ba")
=> 0 ; note: 0 means it found a match at pos 0
(string-match "[^ab]" "ba")
=> nil
No.
Cheers
--
t
signature.asc
Description: PGP signature
- How to get a concatenation of the negations with rx (ex: [^a][^b])?, Edgar Lux, 2023/11/11
- Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?, Michael Heerdegen, 2023/11/12
- Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?, tomas, 2023/11/12
- Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?, Yuri Khan, 2023/11/12
- Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?, tomas, 2023/11/12
- Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?, Michael Heerdegen, 2023/11/12
- RE: How to get a concatenation of the negations with rx (ex: [^a][^b])?, Anders Munch, 2023/11/13
- Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?, tomas, 2023/11/13
Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?, Emanuel Berg, 2023/11/13
- Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?,
tomas <=