Guest User

Untitled

a guest
Jun 30th, 2018
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 0.95 KB | None | 0 0
  1. #!/usr/bin/tclsh
  2.  
  3. set date "1 Březen 2012"
  4. set content "<b>ŽELEZNÁ LADY</b></a><span class=\"text\"> dne 1 Březen 2012</span>"
  5.  
  6. puts "'$date' == '1 Březen 2012'? (encoding system: [encoding system])"
  7.  
  8. if {$date == "1 Březen 2012"} {puts "yes"} else {puts "NO!"}
  9.    
  10. if {![regexp {<b>([^<]+)</b></a><span[^>]+> dne 1 Březen 2012</span>} $content match movie]} {
  11.         puts "No match using literal utf-8 date!?"
  12.         return 1
  13. }
  14. puts "Matched movie: '$movie' using literal utf-8 date."
  15.  
  16. if {![regexp {<b>([^<]*)</b></a><span[^>]*> dne $date</span>} $content match movie]} {
  17.         puts "No match using utf-8 date from variable!?"
  18.         return 1
  19. }      
  20. puts "Matched movie: '$movie' using utf-8 date from variable."
  21.  
  22. return 0
  23.  
  24. ==============================
  25. OUTPUT:
  26.  
  27. '1 Březen 2012' == '1 Březen 2012'? (encoding system: utf-8)
  28. yes
  29. Matched movie: 'ŽELEZNÁ LADY' using literal utf-8 date.
  30. No match using utf-8 date from variable!?
Add Comment
Please, Sign In to add comment