Twistpad Carthago Software forums / Twistpad /  

 BUG: Some regular expression problems

 
Daniel Walker
Member
#1 | Posted: 27 Jan 2012 04:52 | Edited by: Daniel Walker 
Hi. I've been having problems with regular expressions in Twistpad which appear to be small bugs in the implementation.

#1: "Find and Replace All" tagged expressions use the subexpressions from the first match instead of the relevant match.

#2: "*" should be greedier than it currently is - currently it behaves more like "*?". ".*" should be equivalent to ".*$" when at the end of an expression, but it isn't; and searching for "a[a-z]*bra" on "abracadabra" should match the entire word, but instead matches only "abra".

#3: "Wrap Searchs" misses the first match in the document if that match begins on line 1 column 1. (Also, "Wrap Searchs" should be written as "Wrap search" or "Wrap searches" for correct spelling and consistent use of cases.)

4: Not a bug, but it would be nice if there was a preference to stop the "Find what" field from populating itself with whatever happens to be under the cursor.

As an example, let's say I have a document consisting of the following lines of text:
look
lake
like
link
leak

If I do a find and replace using
Find what: l(.).*k.*
Replace with: $1
and then say "Replace All", then the document should change to:
o
a
i
i
e

Instead it changes to this:
o
oe
oe
o
o

That exhibits problem #1 and #2

If I instead place the cursor anywhere other than line 1 column 1, and then open the Find and Replace dialogue box and press "Replace" until no more matches are found, then I get this:
look
ae
ie
i
e

That exhibits problem #2 and #3.

Andre Santos
Carthago
Moderator
#2 | Posted: 29 Jan 2012 15:56 
Hi,

Thanks for you report.

#1 and #3 are bugs, I will look into them for the next version.

#4 Yes.. it could be an option.

for #2.. Twistpad uses a third party library as its regular expression engine, so I will have a look into the documentation. I know RE can be more "greedy" or less, so maybe it could be an option.

Thanks,
André Santos
Carthago Software Support
http://www.carthagosoft.net

Daniel Walker
Member
#3 | Posted: 31 Jan 2012 13:01 
Thanks. I appreciate it and look forward to the update.

Twistpad Carthago Software forums / Twistpad /
 BUG: Some regular expression problems

Your Reply Click this icon to move up to the quoted message


 
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.

 

  Powered By minibb