Help for this page

Select Code to Download


  1. or download this
    ($reg_exp = $user_query) =~ s/(\W)/$1 eq '*' ? "\\S*" : "\\$1"/ge;
    
  2. or download this
    # File as an array of lines:
    @matching_lines = grep { /$reg_exp/ } @lines_to_search;
    
  3. or download this
    # File in a scalar:
    @matching_lines = $file =~ /^(.*${reg_exp}.*)$/mg;