Thought I found a regular expression bug

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
shoeboy
Posts: 1
Joined: Wed Dec 19, 2007 3:41 pm

Thought I found a regular expression bug

Post by shoeboy »

I may have found a regular expression bug:
Replace:
+\|\| +

With:
+

Text:
+

Result:
618626 length string of " + ...."
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

You're asking it to replace a non-empty sequence of spaces OR nothing OR a non-empty sequence of spaces with a plus sign. If your current position is just in front of a plus sign in your document, TextPad doesn't find a non-empty sequence of spaces there, but it does find a nothing. So it replaces that nothing with a plus sign. Its position is now just in front of the original plus sign, as it was before. So it does the same thing again, and again,... until you stop it.

What were you trying to do?

Here's a useful tip: use Posix syntax for your regular expressions. It makes them much more intelligible:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Then you can do without the backslashes in your regular expression.
Post Reply