I am trying to use reg. expr and repl. format, on two almost identical test files, and the behavior is not correct (I guess).
I've posted some files here:
http://www.cyamon.com/zip/wildedit.zip
The image shows what reg.expr/repl. format I am using.
If you load the ''Working.pas'' file (in the test pane) and hit F4, you'll see that:
while ((Dir <> '') or (Drive <> '')) and (WideCanvasTextWidth(Canvas, Result) > MaxLen) do
is correcly replaced by:
while ((Dir <> '') or (Drive <> '')) and (Canvas.TextWidth(Result) > MaxLen) do
begin
Now, if you load the NotWorking.pas file, which is identical to the previous one except that there is more text /after/ the ''replacement'' point, and hit F4, then you wil get this:
while ((Dir <> '') or (Drive <> '')) and (Canvas, Result) > MaxLen) do
begin
Which is different from the previous case! I don't understand this.
Thank you for helping.
Chris
Regular expl/Repl format does not work in this case, why?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Please don't refer to screen shots; it forces those who are trying to help you to retype in your text, wasting their time and possibly introducing errors.
Select
Options | Matching options: | '.' does not match a newline character
You are selecting everything, including newlines, up to the last comma in the text. Look at what happens to the line
SizeOf(Buffer), nil);
after the replacement.
Alternatively, use
WideCanvasTextWidth\((.*?),\s*
instead of
WideCanvasTextWidth\((.*),\s*
* matches as much as possible, while *? matches as little as possible.
Select
Options | Matching options: | '.' does not match a newline character
You are selecting everything, including newlines, up to the last comma in the text. Look at what happens to the line
SizeOf(Buffer), nil);
after the replacement.
Alternatively, use
WideCanvasTextWidth\((.*?),\s*
instead of
WideCanvasTextWidth\((.*),\s*
* matches as much as possible, while *? matches as little as possible.
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
Thanks ben_josephs. I had hoped to offer some help, but could not be bothered to go to another site, then jump back and forth, etc. So I chose not to get involved. Once again, you are much more tolerant than I. You are to be thanked once more.Please don't refer to screen shots;
Hope this was helpful.............good luck,
Bob
Bob
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm