Closed scottchiefbaker closed 4 years ago
If you're making a list of quote delimiters, {} should be supported too.
On Mon, Jun 29, 2020, 03:34 Scott Baker notifications@github.com wrote:
Consider the following code to remove https:// from a string
my $str = "https://google.com";
Triggers a warning (but is must more readable)
$str =~ s|https://||;
No warning, but a lot harder to read
$str =~ s/https:\/\///;
I think alternate regexp delimiters should be considered standard. At least some primary chars like: |, /, !', and maybe @` should be OK.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xsawyerx/guacamole/issues/89, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFURPKWVKTLZETW6WSF2RADRY7ORTANCNFSM4OKY75RA .
s
can use the following additional delimiters:
s{}{}
s[][]
s()()
s!!!
Pipe is possible but I'm not a fan because it's a fairly distance character for non-Perl devs who aren't used to other Perl devs using it. (I never used it personally.) Will s!!!
not work?
I dunno why but I've always used |
as an alternate delimiter. it's not a huge deal breaker though. I can switch to !
.
Not really clear what this means:
I'm not a fan because it's a fairly distance character for non-Perl devs who aren't used to other Perl devs using it
FWIW I favor being extremely liberal in delimiters. |, for example, is visually quite distinct, and can have the right 'look' in some cases. Of course, if the strings to be delimited contain ! but not | , then | is a superior choice. And I can imagine some application which has painted itself into a corner where the only character that is not in a delimited string is '3' is, in which case the digit 3 is the ideal delimiter. I personally like to have any printable character available as a delimiter, just in case.
I took an informal poll on #perl and |
was a popular delimiter. I'm fine if we want to exclude it, but bear in mind it's used in a lot of "real" code.
I think the point here is to restrict this and get back some sanity. I remember seeing code that used \0
as delimiters... which is great for war stories, but is totally bonkers. I am personally also against #
because I want my brain to think "comment" when I see a #
.
FWIW, I personally like using |
as a delimiter. But I will go along with any restricted list that excludes crazy shit.
I dunno why but I've always used
|
as an alternate delimiter. it's not a huge deal breaker though. I can switch to!
.Not really clear what this means:
I'm not a fan because it's a fairly distance character for non-Perl devs who aren't used to other Perl devs using it
Sorry, this is my poor phrasing.
I meant that, if you're not a Perl developer who saw a different Perl developer use the pipe operator as a delimiter, you wouldn't even think about using it. Of course, this is a presumption on my part.
I'm okay adding the pipe symbol as a delimiter. I'll try to add it this week. (I want to add a bunch of docs and merge other stuff too for a release this weekend.)
Sounds good. Thank you for being flexible on this issue.
Honestly, no reason here for me to be stubborn. The pipe symbol still gives us all we want. Also, I'm not likely to argue a point that is in opposition to both @gonzus and @jeffreykegler. :)
PR now available.
This is now available in 0.005, on CPAN: https://metacpan.org/pod/standard.
This is issue is resolved after testing with 0.005.
Consider the following code to remove
https://
from a stringI think alternate regexp delimiters should be considered standard. At least some primary chars like:
|
,/
,!', and maybe
@` should be OK.