Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/tclsh
- set date "1 Březen 2012"
- set content "<b>ŽELEZNÁ LADY</b></a><span class=\"text\"> dne 1 Březen 2012</span>"
- puts "'$date' == '1 Březen 2012'? (encoding system: [encoding system])"
- if {$date == "1 Březen 2012"} {puts "yes"} else {puts "NO!"}
- if {![regexp {<b>([^<]+)</b></a><span[^>]+> dne 1 Březen 2012</span>} $content match movie]} {
- puts "No match using literal utf-8 date!?"
- return 1
- }
- puts "Matched movie: '$movie' using literal utf-8 date."
- if {![regexp {<b>([^<]*)</b></a><span[^>]*> dne $date</span>} $content match movie]} {
- puts "No match using utf-8 date from variable!?"
- return 1
- }
- puts "Matched movie: '$movie' using utf-8 date from variable."
- return 0
- ==============================
- OUTPUT:
- '1 Březen 2012' == '1 Březen 2012'? (encoding system: utf-8)
- yes
- Matched movie: 'ŽELEZNÁ LADY' using literal utf-8 date.
- No match using utf-8 date from variable!?
Add Comment
Please, Sign In to add comment