Skip to content
Tcl Source Code History Of Ticket 1230253
Login

History Of Ticket 1230253

Artifacts Associated With Ticket 1230253

  1. Ticket change [f6ea632e8a] (rid 130396) by elfring on 2005-06-30 10:07:11:

    1. assignee initialized to: "pvgoran"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      http://tcl.tk/man/tcl8.5/TclCmd/regexp.htm:
      I want that matches can be stored into an array instead 
      of "subMatchVars".
      I imagine cases where I can not use finite and 
      predefined variable names because the search pattern 
      was dynamically constructed.
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "elfring"
    9. subsystem initialized to: "43. Regexp"
    10. title initialized to: "match array"
    11. type initialized to: "RFE"
  2. Ticket change [8b7a779d9d] (rid 127574) by msofer on 2005-06-30 18:01:20:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Doesn't the '-inline' option provide what you need? It
      returns the matches in a list.
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Ticket change [f33c71af36] (rid 129669) by elfring on 2005-07-01 23:03:52:

    1. assignee changed to: "msofer"
    2. icomment:
      Logged In: YES 
      user_id=572001
      
      Well, it can be one way for a solution.
      Can the extra conversion step of this list into an array be 
      avoided?
      (Each data type has got its own advantages.)
      
      
    3. login: "elfring"
    4. mimetype: "text/plain"
    5. username: "elfring"
  4. Ticket change [1ce29f5e13] (rid 90691) by msofer on 2005-07-01 23:14:29:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      I do not fully understand the spec for your request: what
      would be the array keys for the different matches? 
      
      If it is the order in which they are found, the list result
      is the correct format - just access themby [lindex], or
      [foreach]. Or convert to an array if you think you must. In
      that case, my opinion is that the core should be doing it
      for you.
      
      If the array keys are something else (maybe some part of the
      regular expression itself?), maybe ... Although it is not at
      all clear to me yet how we could do this.
      
      Can you please provide an example of what would happen if
      this feature is implemented?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  5. Ticket change [b3e463082f] (rid 124928) by dkf on 2005-07-02 04:57:17:

    1. assignee changed to: "dkf"
    2. closedate changed to: "2005-07-01T21:57:17"
    3. closer changed to: "dkf"
    4. icomment:
      Logged In: YES 
      user_id=79902
      
      I see no need for such a thing.
      
      Quite apart from the -inline option described by Miguel, the
      -about option returns (among other things) the maximum
      number of subMatchVars required by a particular RE, so
      allowing for the construction of a command to perform the
      matching and place the submatches directly into any
      variable(s) chosen. This means that this would all be
      syntactic sugar at best (and is, of course, easily simulated
      using a procedure).
      
      (Maintainer Note: The [regexp] command, as opposed to the RE
      guts, is in Category 18)
      
      
    5. login: "dkf"
    6. mimetype: "text/plain"
    7. resolution changed to: "Rejected"
    8. status changed to: "Closed"
    9. subsystem changed to: "18. Commands M-Z"
    10. username: "dkf"
  6. Ticket change [2420807099] (rid 131062) by msofer on 2005-07-02 05:57:53:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Correcting a bad typo in my last comment here: "... my
      opinion is that the core should NOT be doing it for you."
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  7. Ticket change [ac86c60f87] (rid 101312) by elfring on 2005-07-02 14:45:48:

    1. assignee changed to: "msofer"
    2. icomment:
      Logged In: YES 
      user_id=572001
      
      How do you think about this use case?
      I imagine the following function calls to import mapping
      tables into corresponding data structures.
      
      set source1 {Pi/3.1415,Tax/0.16,}
      set pattern1 {([^/]+)/(.+),}
      regexp -all -array vector1 $pattern1 $source1
      regexp -all -list contents1 $pattern1 $source1
      set source2 {1-title:23-name:456-address:}
      set pattern2 {([^\-]+)-(.*):}
      regexp -all -type array -param vector2 $pattern2 $source2
      regexp -all -type list -param contents2 $pattern2 $source2
      
      
    3. login: "elfring"
    4. mimetype: "text/plain"
    5. resolution changed to: "Later"
    6. status changed to: "Open"
    7. username: "elfring"
  8. Ticket change [a1fc5f5f9d] (rid 109817) by msofer on 2005-07-02 20:36:49:

    1. closedate changed to: "2005-07-02T13:36:49"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      I still do not quite get it. I think you are proposing to
      have a builtin capability to do something like
      
      foreach {- key val} [regexp -all -inline $pattern $source] {
          set vector($key) $val
      }
      
      What should happen if the pattern does not always produce an
      even number of submatches? Would that be an error? What if
      the pattern is capable of producing an odd number of
      submatches, but doesn't with the particular input : error or
      not?
      
      As it is, I do not think the complication is really worth
      it. You can easily get this functionality in a proc. It is
      quite unlikely that the performance impact will be
      noticeable, if this is what is worrying you: proc calls and
      [set] are quite a bit faster than [regexp] in any case.
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Rejected"
    7. status changed to: "Pending"
    8. username: "msofer"
  9. Ticket change [da082cfd8c] (rid 107702) by elfring on 2005-07-03 01:30:19:

    1. icomment:
      Logged In: YES 
      user_id=572001
      
      What is your intention with the use of the variable name "-"?
      
      Well, I guess that this kind of loop for the conversion from
      a list to an array can be more efficiently implemented in C
      code. I assume that there are speed improvements and reduced
      memory consumption possible because the value copies to the
      variables (key, val) can be avoided in the internal processing.
      
      
    2. login: "elfring"
    3. mimetype: "text/plain"
    4. status changed to: "Open"
    5. username: "elfring"
  10. Ticket change [7132cb9c8b] (rid 100629) by msofer on 2005-07-03 02:02:44:

    1. assignee changed to: "dkf"
    2. closedate changed to: "2005-07-02T19:02:44"
    3. closer changed to: "msofer"
    4. icomment:
      Logged In: YES 
      user_id=148712
      
      The variable name "-" is just a mnemonic for "a variable
      that I actually do not care about, and will not be
      dereferencing".
      
      As to the performance win: trust me, it is not there in any
      simple implementation. It will actually be slower. It could
      be made marginally faster, at a complexity cost that is way
      beyond reasonable.
      
      Returning the ticket to dkf, as (a) this is not my area and
      (b) he did claim it. Please do not alter maintainer
      assignments arbitrarily.
      
      
    5. login: "msofer"
    6. mimetype: "text/plain"
    7. status changed to: "Closed"
    8. username: "msofer"
  11. Ticket change [8335798952] (rid 117353) by dkf on 2005-07-04 02:44:20:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      To reaffirm: requested feature can be implemented using a
      Tcl procedure, and adding it to the core is a fair bit of
      effort which would be better spent elsewhere. All
      significant costs can be worked around in one way or another
      with existing facilities.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. priority changed to: "1 Zero"
    5. status changed to: "Deleted"
    6. username: "dkf"