http://qs321.pair.com?node_id=11145328


in reply to Re^3: How to replace spaces with different chars?
in thread How to replace spaces with different chars?

>
$datum =~ s/ /[\\;:,-]/g; system("ls -1 $datum");'

I have no linux to test at hand, but does ls really support regex-character classes?

the -1 option doesn't seem to activate this https://www.man7.org/linux/man-pages/man1/ls.1.html

and I'm confused why ls should support something above globbing ...

plz enlighten me! :)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^5: How to replace spaces with different chars?
by hippo (Bishop) on Jul 07, 2022 at 13:48 UTC
    does ls really support regex-character classes?

    It isn't ls which supports it, but the shell's globbing. All shell globs support character classes inside square brackets. Well, all Bourne-like shells anyway.


    🦛

Re^5: How to replace spaces with different chars?
by kcott (Archbishop) on Jul 07, 2022 at 14:19 UTC

    I see ++hippo has provided an answer.

    For full documentation of what's happening, see man bash; follow the EXPANSION link; scroll down (lots) to "Pathname Expansion" for screenfuls of information.

    — Ken