Tcl Source Code

Ticket Change Details
Login
Overview

Artifact ID: 3b22e98da4efc7957b03c0194c40b743cefc7c75
Ticket: fe4fca32d988f67704a9fec3372bf340c81c3cef
mixed-greediness regular expressions need better documentation
User & Date: glennj 2015-03-24 14:55:43
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    Currently, the MATCHING section of the re_syntax man page talks about "preferences", and states:
    
    > A branch has the same preference as the first quantified atom in it which has a preference.
    
    I don't this this is sufficiently clear to illustrate the differences between
    
        $ perl -e 'if ("1234" =~ /(\d+?)(\d+)/) {print "$& $1 $2\n"}'
        1234 1 234
        $ echo 'puts [regexp -inline {(\d+?)(\d+)} "1234"]' | tclsh
        12 1 2
    
    Can we have an explicit statement? Something like:
    
    > If the first quantifier in a branch of a RE is non-greedy, /all/ quantifiers in the branch will be considered as non-greedy.
    
    However, I just noticed something I can't explain: what's the difference between these?
    
        $ echo 'puts [regexp -inline {(?:(\d+?)(\d+))} "1234"]' | tclsh
        12 1 2
        $ echo 'puts [regexp -inline {s+?|(?:(\d+?)(\d+))} "1234"]' | tclsh
        1234 1 234
    
  5. foundin changed to: "8.6"
  6. is_private changed to: "0"
  7. login: "glennj"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "d3087a52abea86234116c6d0fc932ab13864ef48"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "glennj"
  14. subsystem changed to: "- New Builtin Commands"
  15. title changed to:
    mixed-greediness regular expressions need better documentation
    
  16. type changed to: "Bug"