Forum OpenACS Q&A: Response to Ybos Content Managemnet errors REGEXP

Collapse
Posted by Dave Bauer on
I am also getting this error when I try to upload a new version of a file through document-upload-2.tcl.
[02/Nov/2000:22:04:36]
    Error: couldn't compile regular expression pattern: brackets [] not balanced
    couldn't compile regular expression pattern: brackets [] not balanced
        while executing
    "regexp {([^//]+)$} $upload_file match client_filename"
        invoked from within
    "if ![regexp {([^//]+)$} $upload_file match client_filename] {
        # couldn't find a match
        set client_filename $upload_file
    }"
        (file "/web/devel/www/cm/document-upload-2.tcl" line 60)
        invoked from within
    "source $script"
        (procedure "ns_sourceproc" line 6)
        invoked from within
    "ns_sourceproc cns61 {}"
Here is the code that I believe is causing the error:
# strip off the C:directories... crud and just get the file name               
if ![regexp {([^/]+)$} $upload_file match client_filename] {
     # couldn't find a match
     set client_filename $upload_file
}                                                                               
document-upload-new-2.tcl has the exact same regexp and it works fine. I can upload a new file, but not a new version of an existing file. Here is the regexp in document-upload-new-2.tcl
# strip off the C:directories... crud and just get the file name               
if ![regexp {([^/]+)$} $upload_file match client_filename] {
     # couldn't find a match
     set client_filename $upload_file
}
I really don't have the hang of regular expressions yet. Thanks!