Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- allowed_chars = 'AS49BWXCcahpnz07'.chars
- regex = File.read('regex.txt')
- patterns = regex.split('|')[3..-1]
- unallowed_chars = Hash.new([])
- patterns.each do |pattern|
- position = pattern.match(/\{(\d*)\}/)[1].to_i # get digits inside {}
- chars = pattern.match(/\[(.*)\]/)[1].chars # get characters inside []
- unallowed_chars[position] += chars
- end
- str = 196.times.map { |i| (allowed_chars - unallowed_chars[i])[0] }.join
- puts str
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement