Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b5acf3162916f5835f86a3520a09e52bb2128f875a738f1630294023e9d6c7ce
Ticket: 4ed788c618b36e1247bd276c985c750c3b2267bd
regexp \U not fully implemented - unclear in docs
User & Date: juliannoble2 on 2023-11-18 19:30:45
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    regexp of \Ustuvwxyz is mentioned in the re_syntax docs below \uwxyz but behaves quite differently.
    
    \u can be used in braced expressions - whereas \U only seems to function properly in unbraced regexes where the \U entries become literal characters.
    
    It is unclear whether this is intentional or awaiting implementation in the core for regexp. The docs for \U mention 'reserved for a Unicode extension up to 21 bits'. The wording here could be clarified if that means it is not intended to function out of the box.
    
    Character ranges for braced \U regexes work in the range up to FFFF when the upper bound is expressed as \U0000FFFF or equivalent, but only up to FFFD if the upper bound is expressed as \U0010FFFF
    
    (I note that FFFE and FFFF are 'noncharacters' - but there are 32 other noncharacters in the BMP that aren't excluded. For best utility, I wouldn't expect any to be excluded in this context - but if the wording in docs refers to 'characters' rather than codepoints or whatever terminology is appropriate here, and it really is the intention to exclude noncharacters; then that's another point that may need explanation)
    
    90b1rc
    
      % regexp -all -inline -indices {[\U00000080-\U0000FFFF]} X\UFFFEY
      {1 1}
      % regexp -all -inline -indices {[\U00000080-\U0010FFFF]} X\UFFFEY
      %
    
    Higher tests can be done with substituted regexes rather than braced ones - but that is much less convenient as regexes get more complex, and different enough from the \u behaviour that it may warrant more explicit documentation if it isn't intended to operate similarly without some sort of extra package.
    
    90b1rc
    
      % regexp -all -inline -indices "\[\U00000080-\U0010FFFF\]" X\U1FFFFY
      {1 1}
    
    
    This isn't specific to the 90-b1 release candidate - but I notice that there are at least 3 different behaviours for certain \U regexes in recent years, which I guess isn't surprising given the complex work being done to support unicode in Tcl, but it does underscore a need to have the docs reflect intended behaviour.   
    
    8.6.12
    
      %regexp -all -inline -indices {[\U80-\U0000FFFF]} X\U0001FFFFY
      {1 1}
    
    bawt 8.7a5
    
      %regexp -all -inline -indices {[\U80-\U0000FFFF]} X\U0001FFFFY
      {1 1} {2 2}
    
    8.7a6 (+)
    
      % regexp -all -inline -indices {[\U80-\U0000FFFF]} X\U0001FFFFY
      %
    
  5. foundin changed to: "9-0-b1-rc"
  6. is_private changed to: "0"
  7. login: "juliannoble2"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "juliannoble2"
  14. subsystem changed to: "43. Regexp"
  15. title changed to: "regexp \U not fully implemented - unclear in docs"
  16. type changed to: "Bug"