Skip to content

Instantly share code, notes, and snippets.

Created July 15, 2016 14:35
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/6ac84c4b016b9060153351ec205894c3 to your computer and use it in GitHub Desktop.
Save anonymous/6ac84c4b016b9060153351ec205894c3 to your computer and use it in GitHub Desktop.
1.9.3-p551 :041 > txt = <<eof
1.9.3-p551 :042"> slow_query_log
1.9.3-p551 :043"> slow_query_log_file = slow-log
1.9.3-p551 :044"> long_query_time = 13
1.9.3-p551 :045"> min_examined_row_limit = 42
1.9.3-p551 :046"> log-queries-not-using-indexes = 1
1.9.3-p551 :047"> eof
=> "slow_query_log\nslow_query_log_file = slow-log\nlong_query_time = 13\nmin_examined_row_limit = 42\nlog-queries-not-using-indexes = 1\n"
1.9.3-p551 :048 > regex1 = /.*slow_query_log.*slow_query_log_file = slow-log.*long_query_time = 13.*min_examined_row_limit = 42.*log-queries-not-using-indexes = .*/m
=> /.*slow_query_log.*slow_query_log_file = slow-log.*long_query_time = 13.*min_examined_row_limit = 42.*log-queries-not-using-indexes = .*/m
1.9.3-p551 :049 > regex2 = %r{
1.9.3-p551 :050/> .*slow_query_log.*
1.9.3-p551 :051/> slow_query_log_file = slow-log.*
1.9.3-p551 :052/> long_query_time = 13.*
1.9.3-p551 :053/> min_examined_row_limit = 42.*
1.9.3-p551 :054/> log-queries-not-using-indexes = .*
1.9.3-p551 :055/> }xm
=> /
.*slow_query_log.*
slow_query_log_file = slow-log.*
long_query_time = 13.*
min_examined_row_limit = 42.*
log-queries-not-using-indexes = .*
/mx
1.9.3-p551 :056 > regex1.match txt
=> #<MatchData "slow_query_log\nslow_query_log_file = slow-log\nlong_query_time = 13\nmin_examined_row_limit = 42\nlog-queries-not-using-indexes = 1\n">
1.9.3-p551 :057 > regex2.match txt
=> nil
1.9.3-p551 :058 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment