title: Issue dealing with white space with Ruby regular expressions
body: <p>I'm trying to write a simple script expression that allows me to identify the java files in a directory that have a private constructor.  I have had some luck but I want my script to acknowledge there is white space between the access modifier and the constructor name but not care if it is a space or n spaces or a tab or n tabs etc.</p>
  
  <p>I am trying to use...</p>
  
  <pre><code>"private\s+"+object_name
  </code></pre>
  
  <p>but the + (1 or more) is not finding a constructor with 2 spaces between the modifier and the constructor name.</p>
  
  <p>I know I am missing something.  Any help would be greatly appreciated.</p>
  
  <p>Thanks.</p>
  
  <p>Here is the full code if it helps...</p>
  
  <pre><code>!#/usr/bin/ruby
  
  path = ARGV[0]
  if path.nil?
      puts "missing path argument"
      exit
  end
  
  entries = Dir.entries( path )
  
  entries.each do |file_name|
      file_name = file_name.rstrip
      if ( file_name.end_with? "java" )
          text = File.read( path+file_name )
          object_name = file_name.chomp( ".java" )
          search_str = "private\s+"+object_name
              matches = text.match( Regexp.escape( search_str ) )
              if ( !matches.nil? &amp;&amp; matches.length &gt; 0 )
                  puts matches
              end
          end
  end
  </code></pre>