-
Notifications
You must be signed in to change notification settings - Fork 580
s// /g weirdness #3516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From @simoncozensMaybe this is something obvious I missed, and I know I'm dealing with $_ = "this/is/a/test"; y#/#\n#; s// /g; print prints t h i s as I'd expect, whereas $_ = "this/is/a/test"; s#/#\n#g; s// /g; print prints this which I wouldn't. s//foo/ wants to be the first match in the program Perl Info
|
From @pjscottAt 02:36 PM 3/4/2001 +0000, simon@netthink.co.uk wrote:
No bug. The empty regular expression is defined as matching the last successfully matched regex; see perlop/"Regexp Quote-Like Operators". The man page could stand some mention of the behavior you did expect, though :-) Inline Patch--- pod/perlop.pod.orig Sun Mar 4 07:40:18 2001
+++ pod/perlop.pod Sun Mar 4 07:44:22 2001
@@ -808,6 +808,8 @@
If the PATTERN evaluates to the empty string, the last
I<successfully> matched regular expression is used instead.
+If there is no previous regular expression, successfully matched or
+otherwise, an empty PATTERN matches an empty substring.
If the C</g> option is not used, C<m//> in list context returns a
list consisting of the subexpressions matched by the parentheses in the |
Migrated from rt.perl.org#5959 (status was 'resolved')
Searchable as RT5959$
The text was updated successfully, but these errors were encountered: