Skip to content

Instantly share code, notes, and snippets.

Created April 19, 2016 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/b647cd091ab7d0a88a4fc14fc85e77b9 to your computer and use it in GitHub Desktop.
Save anonymous/b647cd091ab7d0a88a4fc14fc85e77b9 to your computer and use it in GitHub Desktop.
name_regex = /
\s+
(?<evs>\S+)
\s+
(?<mode>(ADS|NT4))
\s+
(?<status>\S+)
\s+
(?<domain>\S+)
\s+
(?<name>\S+)
/x
name_list = "Configured names.
evs mode status domain serving name
1 NT4 online DOMAIN1 machine123
1 NT4 online DOMAIN1 machine2-3-4
1 ADS online DOMAIN1 machine-machine
"
@extracted_names = name_list.scan(name_regex)
puts @extracted_names[0][:name]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment