From: Jeff Schoolcraft Date: 2012-04-12T11:25:47+09:00 Subject: Re: Regular expression help This is a multi-part message in MIME format. --------------090706010403060602080200 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Here's a quick version: http://rubular.com/r/8Shi9ikzAA That help? > Alex Sweps > April 11, 2012 10:21 PM > Hello all > > I have written a script to search the current directories and grab the > file path for a set of filtered files. Example of what it returns: > c:/Documents and > Settings/Administrator/Desktop/version3/test_files/apserver1.int-APACHE.gz > c:/Documents and > Settings/Administrator/Desktop/version3/test_files/apserver2.int-APACHE.gz > c:/Documents and > Settings/Administrator/Desktop/version3/test_files/apserver3.int-APACHE.gz > > What I am trying to do is extract only the server names. So apserver1, > apserver2 and apserver3. I need a regular expression that will grab > everything after the last forward slash and then the text before the > first "." So far I can only get it grab everything after the first > forward slash. So far I have: > > apache_server_filter.each do |x| > puts x.to_s.scan(/(\/\D+)/) > end > > This pulls out: /Documents and Settings/Administrator/Desktop/version > /test_files/ap > > Does anyone have any ideas? > > Thanks :) > --------------090706010403060602080200 Content-Type: multipart/related; boundary="------------040300040603030507080509" --------------040300040603030507080509 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
Here's a quick version: http://rubular.com/r/8Shi9ikzAA

That help?

April 11, 2012 10:21 PM
Hello all

I have written a script to search the current directories and grab the
file path for a set of filtered files. Example of what it returns:
c:/Documents and
Settings/Administrator/Desktop/version3/test_files/apserver1.int-APACHE.gz
c:/Documents and
Settings/Administrator/Desktop/version3/test_files/apserver2.int-APACHE.gz
c:/Documents and
Settings/Administrator/Desktop/version3/test_files/apserver3.int-APACHE.gz

What I am trying to do is extract only the server names. So apserver1,
apserver2 and apserver3. I need a regular expression that will grab
everything after the last forward slash and then the text before the
first "." So far I can only get it grab everything after the first
forward slash. So far I have:

apache_server_filter.each do |x|
puts x.to_s.scan(/(\/\D+)/)
end

This pulls out: /Documents and Settings/Administrator/Desktop/version
/test_files/ap

Does anyone have any ideas?

Thanks :)

--------------040300040603030507080509 Content-Type: image/jpeg; x-apple-mail-type=stationery; name="compose-unknown-contact.jpg" Content-Transfer-Encoding: base64 Content-ID: Content-Disposition: inline; filename="compose-unknown-contact.jpg" /9j/4AAQSkZJRgABAQEARwBHAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEC AQEBAQEBAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL/2wBDAQEBAQEBAQICAgICAgIC AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL/wAAR CAAZABkDAREAAhEBAxEB/8QAGAAAAwEBAAAAAAAAAAAAAAAABgcICQr/xAA0EAABAwMCAgUK BwAAAAAAAAACAQMEBQYRABITIQcUMUF2CBUXIjI2N0JRtVRWkZOV0dL/xAAYAQEAAwEAAAAA AAAAAAAAAAADAAEEAv/EACQRAAICAAQGAwAAAAAAAAAAAAABAhEDMrHREyExM0FxgfDx/9oA DAMBAAIRAxEAPwDuEt+gW/ULet6oVC3rfqNQqFv0OfPn1GhUqfOmzZtKZlS5UqZMaNwzNwiJ VIl7eXLCaZIGwBl3TY8epPx2+jy2ZNPjvkwc9uhW8j7nCPhvOsQliYIeS7cvCpp8o50qwrC4 v3lsNSDbdmTEhvs2tahxpfV3WnmbbozJEw/gwdadbYExVRXKEKoSdvJcaOSqxE7/AAiX0gXx +a69/JSf9alIlste0VzaNpeFrcT9KKymotyiaZ0KRCnzacoE7Kjzn4gi2KqUh3jqDHDHv4mR UfruTWlMzlVUKIVNp9GguEJnAh0+IZjyAiisgyRDnu5azS8miKqjOTVkKqS/psG37fo1Fbab eg25b8eZPeFJBBJSjMG5HjMeyihnaauZwe4OGiju13GAcpOwBeN+U8/IkGbsiS8b7ryogmbz hbyc9REROfZhERO5ETShjPtvpGqTUyLErytS4siSwx5x2tRH4hPOI0DkjZtaJtFxuVEbIUUi yeNujlBUJGbJN6nM/Cyf2Hf60YgjvKA+NPSP4gT7axpcPtr51YWJnYn9dnAQWl722p4ot37y zqnlfp6FrqbwawG8/9k= --------------040300040603030507080509-- --------------090706010403060602080200--