Regular expl/Repl format does not work in this case, why?

General questions about using WildEdit

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
azerty
Posts: 3
Joined: Thu Sep 11, 2008 2:29 pm

Regular expl/Repl format does not work in this case, why?

Post by azerty »

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
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

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.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Please don't refer to screen shots;
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.
Hope this was helpful.............good luck,
Bob
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Kind words. Thank you. But I'm not so tolerant! Just uncontrollably curious. :-)
azerty
Posts: 3
Joined: Thu Sep 11, 2008 2:29 pm

Post by azerty »

Gentlemen,

Thank you very much for the help and yes, in the future, I will not use screen shots anymore.

Chris
Post Reply