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

Re: extract values from a string



On 17/04/2022 12:31, Ash Joubert wrote:
Note the change to your regex: '\' changed to '\\' because bash variable interpolation is used to obtain $X . This could be avoided if single quotes were used, but then you would need another way to access your data, such as reading it from stdin.

Actually it works fine with just '\' (not '\\') because neither '\s' nor '\d' (which I neglected) are bash escape sequences. But in general, backlashes might need to be escaped in bash double-quoted strings.

Kind regards,

--
Ash Joubert <ash@transient.nz>
Director
Transient Software Limited <https://transient.nz/>
New Zealand


Reply to: