Posted 19 years ago by MJA - Belgium
Avatar
I want to insert a string at the beginning of lines.
So, I use ^ as the character to find.
Nothing is inserted. The find fails.
Is this the right way ?

-------------------------------------------------------
I want to discard the 6 first characters of lines.
I use ^...... as expression to find and nothing or a space as replacing character.
Replacement is recursive and all my text disappears.

You can test these two cases in the demo program.

Comments (5)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Right now, our regex engine requires that at least one character be consumed to recognize a match. We need to look into how to modify it so that can do zero-width assertion matches as well.

For the second issue, yes it appears that it is a bug. However I'm wondering what the right way to fix it is. What's happening is that it finds the first 6 chars of a line, replaces them with blank, and then starts at the same offset again, sees its still at the beginning of a line and continues on recursing.

.NET doesn't do that somehow. Any idea what shift in logic we should make to get it working right? I don't think we can simply move the pointer after a replace up by one character because you would get this situation:

Replace all "a" with ""
Starting document text: "aaa"
Result: "a"

Which with how we have it right now, would yield the correct result:

Replace all "a" with ""
Starting document text: "aaa"
Result: ""

I'm open to suggestions...


Actipro Software Support

Posted 19 years ago by MJA - Belgium
Avatar
If the replaced string begins with ^, you may go to next line just after replacing. Start of page condition is consumed.
That's the same thing with end of line ($).
Posted 18 years ago by MJA - Belgium
Avatar
Are these problems solved ?
If yes, in which version.
If no, is there a planned date ?
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Sorry both of those are still on the TODO list. I'm not sure of a date yet.


Actipro Software Support

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Quick note... The v4.0 code we're working on now supports zero-length find/replaces. Both of the items you mentioned work great in the new code. It's a very useful feature to be able to add/remove characters at the start or end of lines.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.