1. Shlomi Fish
  2. perl-begin


Shlomi Fish  committed aa8fb49

Add the dot-asterisk item

  • Participants
  • Parent commits dbb1765
  • Branches default

Comments (0)

Files changed (3)


View file
     - long lines in source code.
     - grep !/\A\./ for getting rid of "." and ".." in readdir().
     - assigning a list to a scalar.
+    - Regular expressions starting or ending with .*? or .*


View file
         - show all with IO::All and without it.
 * Add to '/bad-elements/':
-    - Regular expressions starting or ending with .*? or .*
     - Using one variable for two different things
         - assignment to a different value in the middle of the subroutine.
     - Recursively iterating over directories and sub-directories instead of

File src/tutorials/bad-elements/index.html.wml

View file
+<item id="dot_asterisk" h="Regular Expressions starting or ending with “.*”">
+It is not necessary to put <tt>.*</tt> or <tt>.*?</tt> into the beginning or
+end of regular
+expressions to match something anywhere inside the string. So for example
+<tt>if ($hay_stack =~ /.*ab+c.*/)</tt> can be replaced with the simpler:
+<tt>if ($hay_stack =~ /ab+c/)</tt>. If you wish to match and extract the
+prefix, you should say <tt>(.*?)</tt> or <tt>(.*)</tt>.
 #include "bad-elements-sources.wml"