Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. s = 'The only true (wisdom) is in knowing you know (nothing)'
  2. s.match(/(([^)]+))$/).captures
  3.  
  4. s = 'The only true (wisdom) is in knowing you know (nothing)'
  5. s.match(/(?<=()([^)]+)(?=)$)/).captures
  6.  
  7. str = "The only true (wisdom) is in knowing you know (nothing)"
  8. str.scan(/((.+?))/).last
  9. #=> "nothing"
  10.  
  11. s = 'The only true (wisdom) is in knowing you know (nothing)'
  12. s.match(/(([^)]+))$/).captures # => ["nothing"]
  13.  
  14. "...knowing you know ((almost) nothing)"[/(((?:[^()]*|(g<1>))*))$/, 1]
  15. #=> "(almost) nothing"
  16.  
  17. s = 'The only true (wisdom) is in knowing you know (nothing)'
  18.  
  19. r = s.reverse
  20. r[(r.index(')') + 1)...(r.index('('))].reverse
  21. #=> "nothing"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement