[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is wrong with a regex?
From: |
Koichi Murase |
Subject: |
Re: What is wrong with a regex? |
Date: |
Sat, 4 Feb 2023 13:58:32 +0900 |
2023年2月4日(土) 13:10 Peng Yu <pengyu.ut@gmail.com>:
> That would be a syntax error as the return status 2 indicates.
>
> $ f=row.txt; [[ $f =~ ^row([0-9]*)(|_x)[.]txt$ ]]; echo $?
> 2
Ah this is interesting, in my system, it returns 0:
$ f=row.txt; [[ $f =~ ^row([0-9]*)(|_x)[.]txt$ ]]; echo $?
0
Probably this is an extension of <regex.h> in my system (the glibc
version is 2.36). I'm using Bash 5.2.9 in GNU/Linux (Fedora 37).
In that case, you can simply use `(_x)?'. I think the following should
work also in your system:
$ f=row.txt; [[ $f =~ ^row([0-9]*)(_x)?[.]txt$ ]]; echo $?
0
--
Koichi
- Re: What is wrong with a regex?, (continued)
- Re: What is wrong with a regex?, Dennis Williamson, 2023/02/03
- Re: What is wrong with a regex?, Leonid Isaev, 2023/02/04
- Re: What is wrong with a regex?, Koichi Murase, 2023/02/04
- Re: What is wrong with a regex?, Koichi Murase, 2023/02/04
- Re: What is wrong with a regex?, Jeffrey Walton, 2023/02/04
- Re: What is wrong with a regex?, Koichi Murase, 2023/02/04
- Re: What is wrong with a regex?, Leonid Isaev, 2023/02/04
Re: What is wrong with a regex?, Peng Yu, 2023/02/03
- Re: What is wrong with a regex?,
Koichi Murase <=
- Re: What is wrong with a regex?, Leonid Isaev (ifax), 2023/02/04
- Re: What is wrong with a regex?, Peng Yu, 2023/02/04
- Re: What is wrong with a regex?, alex xmb ratchev, 2023/02/04
- Re: What is wrong with a regex?, Kerin Millar, 2023/02/04
- Re: What is wrong with a regex?, alex xmb ratchev, 2023/02/04
Re: What is wrong with a regex?, Chet Ramey, 2023/02/06
Re: What is wrong with a regex?, alex xmb ratchev, 2023/02/06
Re: What is wrong with a regex?, Chet Ramey, 2023/02/06
Re: What is wrong with a regex?, alex xmb ratchev, 2023/02/06