<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.gitignore</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -125,7 +125,9 @@ END
                             [ '--before-context', '-B', GetoptLong::REQUIRED_ARGUMENT ],
                             [ '--context', '-C', GetoptLong::OPTIONAL_ARGUMENT ],
                             [ '-g', GetoptLong::REQUIRED_ARGUMENT ],
-                            [ '-x', '--line-regexp', GetoptLong::NO_ARGUMENT ]
+                            [ '-x', '--line-regexp', GetoptLong::NO_ARGUMENT ],
+                            [ '-s', '--line-start', GetoptLong::NO_ARGUMENT ],
+                            [ '-e', '--line-end', GetoptLong::NO_ARGUMENT ]
                             )
 
     dir = nil
@@ -145,6 +147,8 @@ END
     opt[:print_match] = false
     opt[:match_whole_words] = false
     opt[:match_whole_lines] = false
+    opt[:match_line_starts] = false
+    opt[:match_line_ends] = false
     opt[:print_file_each_line] = false
     opt[:print_file_if_match] = false
     opt[:print_file_if_no_match] = false
@@ -280,6 +284,10 @@ END
           opt[:filename_regex] = arg
         when '-x'
           opt[:match_whole_lines] = true
+        when '-s'
+          opt[:match_line_starts] = true
+        when '-e'
+          opt[:match_line_ends] = true
         end
       end
     rescue GetoptLong::InvalidOption =&gt; ex
@@ -474,6 +482,12 @@ END
     if opt[:match_whole_lines]
       str = &quot;^&quot; + str + &quot;$&quot;
     end
+    if opt[:match_line_starts]
+      str = &quot;^&quot; + str
+    end
+    if opt[:match_line_ends]
+      str = str + &quot;$&quot;
+    end
     if $use_onig
       if opt[:ignore_case]
         re = Oniguruma::ORegexp.new(str, :options =&gt; Oniguruma::OPTION_IGNORECASE)
@@ -517,7 +531,7 @@ END
     code &lt;&lt; %{  elsif fn.is_a? IO               }
     code &lt;&lt; %{    f = fn                        }
     code &lt;&lt; %{  end                             }
-    
+
     code &lt;&lt; %{  f.each_line do |line|                                          }
     code &lt;&lt; %{    i += 1                                                         }
     code &lt;&lt; %{    rest = line                                                      }
@@ -687,6 +701,8 @@ Searching:
   -w, --word-regexp     Force PATTERN to match only whole words
   -x, --line-regexp     Force PATTERN to match only whole lines
   -Q, --literal         Quote all metacharacters; expr is literal
+  -s, --line-start      Match only at the start of a line
+  -e, --line-start      Match only at the end of a line
 
 Search output:
   -l, --files-with-matches</diff>
      <filename>bin/rak</filename>
    </modified>
    <modified>
      <diff>@@ -461,6 +461,22 @@ END
 
 END
   end
+
+  it &quot;-s means match only at the start of a line&quot; do
+    asterize_ansi(%x{rak -s &quot;foo Cap&quot;}).should == t=&lt;&lt;END
+*foo.rb*
+   4|*foo Cap*sicum foo foo foo foo foo
+
+END
+  end
+
+  it &quot;-e means match only at the end of a line&quot; do
+    asterize_ansi(%x{rak -e &quot;kon foo foo&quot;}).should == t=&lt;&lt;END
+*foo.rb*
+   6|foo foo foo foo foo Pi*kon foo foo*
+
+END
+  end
 end
 
 describe &quot;Rak&quot;, &quot;with combinations of options&quot; do</diff>
      <filename>spec/rak_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>52379eb4f3d92beeb943ffaaca01159b0677a213</id>
    </parent>
  </parents>
  <author>
    <name>Daniel Lucraft</name>
    <email>dbl@zabrieski.doc.ic.ac.uk</email>
  </author>
  <url>http://github.com/danlucraft/rak/commit/f5b9d692fd999e7e4c6ccf0b1cf3df7b4dc06d8a</url>
  <id>f5b9d692fd999e7e4c6ccf0b1cf3df7b4dc06d8a</id>
  <committed-date>2007-11-07T04:24:00-08:00</committed-date>
  <authored-date>2007-11-07T04:24:00-08:00</authored-date>
  <message>Added -e and -s options.</message>
  <tree>8c6d25fcdf0154b0a53783c361a5ce1f3b2f7b1f</tree>
  <committer>
    <name>Daniel Lucraft</name>
    <email>dbl@zabrieski.doc.ic.ac.uk</email>
  </committer>
</commit>
