[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Equivalent regex pattern
From: |
Andreas Kusalananda Kähäri |
Subject: |
Re: Equivalent regex pattern |
Date: |
Mon, 6 Jun 2022 09:46:48 +0200 |
On Sun, Jun 05, 2022 at 11:55:28PM +0000, goncholden via wrote:
> What would be the equivalent regex pattern that matches the pattern described
> by the following parameter expansions?
>
> fld="${flentry%[[:blank:]]*}"
This matches the shortest suffix string that starts with a blank (or,
the bit of the string from the last blank to the end).
[[:blank:]][^[:blank:]]*$
>
> fl="${flentry#*[[:blank:]]}"
The shortest prefix string that ends in a blank (or, the bit of the
string from the start to the first blank).
^[^[:blank:]]*[[:blank:]]
--
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden
.