#4194 Limitation on length of characters in regexp

obsolete: 8.5.5

Tcl can not compile regular expression like

regexp {.{x}} $a,

whete $a is string with length more than 256 characters, x is number of characters more than 256. Error message is "couldn't compile regular expression pattern: invalid repetition count(s)"

Will be good, if i can use any x in one expressions.


  • Donal K. Fellows

    • assigned_to: pvgoran --> dkf
    • status: open --> closed-wont-fix
  • Donal K. Fellows

    Allowing this sort of thing unfortunately makes the RE engine blow up on other REs (I forget which bug number dealt with this) as handling counted repetitions is expensive.

  • Alexandre Ferrieux

    Notice that this bug report should have been a feature request, since the limit of 255 is documented in re_syntax.n.
    It ends up as being _POSIX2_RE_DUP_MAX defined in system include file <limits.h> (or one of its offspring).
    No idea what this value does in such a normative position since libc has no regexp support.
    As it turns out, on my CentOS4.6, [egrep 'a{500}'] works... So, what set of tools is legally bound by _POSIX2_RE_DUP_MAX ?


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks