Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/Advanced+Regular+Expression+Examples?V=0
QUERY_STRINGV=0
CONTENT_TYPE
DOCUMENT_URI/revision/Advanced+Regular+Expression+Examples
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.69.6.32
REMOTE_PORT38870
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.144.187.103
HTTP_CF_RAY880508ba0fd861be-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP3.144.187.103
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit {Advanced Regular Expression Examples} {Solve a nasty regular expression problem?  Share your examples for the benefit of others here.  Please include the problem statement, the code and then any discussion.
----

'''Problem Statement: ''' Modify a string with a series of substrings enclosed in double square brackets ([[ ]]) such that they become only single brackets.  Example input: " [[X]] [[abc]] [[123]] ", desired output: " [X] [abc] [123] ".  The actual substrings could be any arbitrarily nasty text, including such things as &, \1 etc.

'''Code: ''' ======
    regsub -all {\[\[(.*?)\]\]} $thebody {[\1]} thebody
======
'''Discussion: '''  The non-greedy expression .*? will expand all text until the first match of ]].  Works great.  This example comes from [Wiki Conversion OddMuse To Confluence] where you can find the entire example.

----

'''Problem Statement: ''' Modify a string containing a series of substrings enclosed in double square brackets ([[ ]]) such that any spaces in that substring are converted to underscores (_).

'''Code: ''' ======
    while { [regsub -all {(\[\[[^] ]+) (.+?\]\])} $thebody {\1_\2} thebody] > 0 } {}

OR

    set idx [regexp -inline -all -indices {\[[^]]*\]} $txt]
    foreach pair $idx {
      foreach {start end} $pair { break }
      set new [string map [list { } _] [string range $txt $start $end]]
      set txt [string replace $txt $start $end $new]
    }
======
'''Discussion: '''  In the first line, a complete iterative approach is taken.  Where there are many more substrings than there are spaces in those substrings, this method clearly computationally efficient.  This example comes from [Wiki Conversion OddMuse To Confluence] where you can find the entire example.  If there are more spaces than substrings then, at some point, it becomes more computationally effficient to follow the second set of statements.  Those statements were constructed by another person on the Tcler's Chat.  There does not seem to be a way to solve this problem in a single step.

----

*** Recommended Template

'''Problem Statement: ''' 

'''Code: ''' ======

======
'''Discussion: '''  

----} regexp2} CALL {my render {Advanced Regular Expression Examples} {Solve a nasty regular expression problem?  Share your examples for the benefit of others here.  Please include the problem statement, the code and then any discussion.
----

'''Problem Statement: ''' Modify a string with a series of substrings enclosed in double square brackets ([[ ]]) such that they become only single brackets.  Example input: " [[X]] [[abc]] [[123]] ", desired output: " [X] [abc] [123] ".  The actual substrings could be any arbitrarily nasty text, including such things as &, \1 etc.

'''Code: ''' ======
    regsub -all {\[\[(.*?)\]\]} $thebody {[\1]} thebody
======
'''Discussion: '''  The non-greedy expression .*? will expand all text until the first match of ]].  Works great.  This example comes from [Wiki Conversion OddMuse To Confluence] where you can find the entire example.

----

'''Problem Statement: ''' Modify a string containing a series of substrings enclosed in double square brackets ([[ ]]) such that any spaces in that substring are converted to underscores (_).

'''Code: ''' ======
    while { [regsub -all {(\[\[[^] ]+) (.+?\]\])} $thebody {\1_\2} thebody] > 0 } {}

OR

    set idx [regexp -inline -all -indices {\[[^]]*\]} $txt]
    foreach pair $idx {
      foreach {start end} $pair { break }
      set new [string map [list { } _] [string range $txt $start $end]]
      set txt [string replace $txt $start $end $new]
    }
======
'''Discussion: '''  In the first line, a complete iterative approach is taken.  Where there are many more substrings than there are spaces in those substrings, this method clearly computationally efficient.  This example comes from [Wiki Conversion OddMuse To Confluence] where you can find the entire example.  If there are more spaces than substrings then, at some point, it becomes more computationally effficient to follow the second set of statements.  Those statements were constructed by another person on the Tcler's Chat.  There does not seem to be a way to solve this problem in a single step.

----

*** Recommended Template

'''Problem Statement: ''' 

'''Code: ''' ======

======
'''Discussion: '''  

----}} CALL {my revision {Advanced Regular Expression Examples}} CALL {::oo::Obj7636245 process revision/Advanced+Regular+Expression+Examples} CALL {::oo::Obj7636243 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4