On 2020/11/23 16:51, Dan Book wrote: > On Mon, Nov 23, 2020 at 7:46 PM L A Walsh <Astara@tlinx.org > <mailto:Astara@tlinx.org>> wrote: > > On 2020/11/18 08:37, Dan Book wrote: > > On Wed, Nov 18, 2020 at 3:17 AM L A Walsh <Astara@tlinx.org > <mailto:Astara@tlinx.org> > > <mailto:Astara@tlinx.org <mailto:Astara@tlinx.org>>> wrote: > > The documentation added by the PR explains it. It removes leading > and > > trailing whitespace. > ---- > That begs the questions: > 0) if whitespace, that includes tabs, LF's CR's, i.e. > any thing '\s' matches? > 1) What if I only want to trim at beginning or end? > 2) Why not support a regex like, say, TCL does? > > I.e. why should a perl command be limited to only trimming > whitespace? > > > This has been discussed in the feature request ticket, summed up > at https://github.com/Perl/perl5/issues/17952#issuecomment-658462652. ---- I didn't see anyone pointing out the circular logic of limiting this to '\s'? I.e. * scottchiefbaker <https://github.com/scottchiefbaker> * commented Jul 14, 2020 <https://github.com/Perl/perl5/issues/17952#issuecomment-658467533> Languages that allow a second argument list of what to remove: PHP Languages that just implement |\s|: Javascript, Ruby, Raku, Python I know for certain that Javascript was heavily influenced by perl, Raku was perl6, python's regex (thus '\s' ) came from perl, and I'm pretty sure Ruby had similar influences. Might want to add TCL to languages that support alternatives to simple whitespace stripping. TAB is oft used as a field separator, and skipping past LF's seems and other white space seems unnatural. That the perl-derived langs all used '\s' just shows how they got lazy and used '\s' instead of a subset or just literal spaces. Certainly support for an optional regex 'range', would be of more use, i.e. [\ \t\j\r...]. Option 4 could be special cased easily enough. So what was the objection to this being an '.xs' module in CORE? Wouldn't the same efficiencies be achieved?Thread Previous | Thread Next