Komodo / KomodoEdit

Komodo Edit is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform.
http://www.komodoide.com/komodo-edit
Other
2.16k stars 303 forks source link

toolbox rx fail on replace #3583

Open WheelDogs opened 6 years ago

WheelDogs commented 6 years ago

Short Summary

rx fails on replace. Indicated an incorrect regsub syntax, though the construction of the syntax is performed by activestate

Steps to Reproduce

see attached...and below Insert 'patrn' into "Regular Expression" field. Insert 'string' into "Search Text" field. Insert "\1 \2" into "Replacement" field

Expected results

The following is the expected results using tkcon

% set patrn { as (\w+)(\s;|\s{|\s*\Z)}

% set string {{Thank you for calling Microsoft.} as op1 {My name is ... .} as Op2 ; {How may I be of assistance to you today?} {How may I help you today?} as AltHelp; Bye as SoLong}

% regsub -all -- $patrn $string {\1 \2}

Results ----------------------------------------------------------------- {Thank you for calling Microsoft.}op1 {My name is ... .}Op2 ; {How may I be of assistance to you today?} {How may I help you today?}AltHelp ; ByeSoLong

Actual results

see attached Error message: "There is an error in your ..." regexpfail1 regexpfail2

Platform Information

Komodo IDE? Komodo Version version 10.2.3, build 89902, platform win32-x86. Built on Tue Jul 11 11:52:38 2017 Operating System (and version)? Win 10

Additional Information

mitchell-as commented 6 years ago

Hi, thanks for the report. As a workaround, you can enclose your search text with {...}.

mitchell-as commented 6 years ago

Developer note: "Regular expression" text should be as (\w+)(\s*;|\s*\{|\s*\Z), "Search Text" should be {Thank you for calling Microsoft.} as op1 {My name is ... .} as Op2 ; {How may I be of assistance to you today?} {How may I help you today?} as AltHelp; Bye as SoLong. Selecting "Match All" works fine. Selecting "Replace" followed by entering \1 \2 gives the error. Workaround is to enclose "Search Text" in {...}. My wild guess is that the Tcl parts of Rx Toolkit are not handling nested braces correctly, but I really have no idea.

WheelDogs commented 6 years ago

Tried you suggestion regarding enclosing the search text in braces. Didn't work. If you have a screen shot of what you did and the results, it would be appreciated.

mitchell-as commented 6 years ago

rx

WheelDogs commented 6 years ago

Thanks...