Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

SO-Q-14942652

By: a guest on Feb 19th, 2013  |  syntax: None  |  size: 1.44 KB  |  views: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.       "(                          # first quote, start capture
  2.         [\p{Word}\.]+?            # One or more word character, or period, LAZY MATCHING
  3.         .*?                       # Zero or more any char, LAZY MATCHING
  4.         \b                        # Word boundary
  5.         [\.,?!»]*?                # Zero or more punctuation, LAZY MATCHING
  6.       )"                          # stop capture, ending quote
  7.  
  8. Execution process:
  9.  
  10. "äöõ "ä õ ü" ï"
  11. # ! is used to denote the current position
  12. # First try for [\p{Word}\.]+?
  13. "ä!
  14. # First try for .*? (empty string)
  15. "ä!
  16. # Not a word boundary, backtrack to .*?
  17. # Second try for .*? (ö)
  18. "äö!
  19. # Not a word boundary, backtrack to .*?
  20. # Third try for .*? (öõ)
  21. "äöõ!
  22. # Word boundary matches
  23. # First try for [\.,?!»]*? (empty string)
  24. "äöõ!
  25. # Quote " not found, backtrack to [\.,?!»]*?
  26. # Can't match any of the characters in [\.,?!»], backtrack to .*?
  27. # Fourth try for .*? (öõ )
  28. "äöõ !
  29. # *** Not a word boundary, backtrack to .*?
  30. # Fifth try for .*? (öõ ")
  31. "äöõ "!
  32. # Word boundary matches
  33. # First try for [\.,?!»]*? (empty string)
  34. "äöõ "!
  35. # Quote " not found, backtrack to [\.,?!»]*?
  36. # Can't match any of the characters in [\.,?!»], backtrack to .*?
  37.  
  38. # Repeat a few times...
  39.  
  40. # 10th try for .*?
  41. "äöõ "ä õ ü!
  42. # Word boundary matches
  43. # First try for [\.,?!»]*? (empty string)
  44. "äöõ "ä õ ü!
  45. # Quote is found, match completed
  46. "äöõ "ä õ ü"!