In uppercase, between commas, you can use:
(my $x = 'a,b,c,d,e') =~ s/(?<=,)([^,]*)(?=,)/ uc($1) /eg;
If you havenโt used images, this is what you got,
(my $x = 'a,b,c,d,e') =~ s/,([^,]*),/ ','.uc($1).',' /eg;
Not only does the look not allow repeating, it does not work without it.
Another common use is the part of the string equivalent to [^CHAR] .
foo(?:(?!foo|bar).)*bar
You can use it to narrow down character classes.
\w(?<!\d)
Although this can now be done using (?[ ... ]) .
It is also useful in more esoteric patterns.
/a/ && /b/ && /c/
can be written as
/^(?=.*?a)(?=.*?b).*?c/s
source share