Match expressions in PFPro NWE 2.5b3

Have a problem? A question? This is the place for answers from other Express users.
Post Reply
User avatar
Matze
Posts: 170
Joined: 2004-12-14 07:54:49
Location: Düsseldorf Germany
Contact:

Match expressions in PFPro NWE 2.5b3

Post by Matze »

Hi there,

I have reported this unexpected behaviour via the bug report, but maybe I am just doing something wrong?

Trying to Find in PFP

[A-Z]:

and replace it with:

() (in Nisus Classic I had written &\s)

replaces every Uppercase character followed by : (so it finds what it is searching) with () (doesn't replace what it should)

Example:
"A:Introduction" becomes "() Introduction" but it should become "A: Introduction"

Thanks for any help, Matze
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Post by martin »

Hi Matze. In PowerFind Pro you'll want to use the backslash character followed by a zero. In your example you would want:

Find "[A-Z]:"
Replace With "\0 "

"\0" is just a special case for backreference replacing. In general you use backslash followed by the index of the backreference you want to substitute. Zero is the index for the whole match, one is the index of the first submatch, two for the second submatch, etc. As an example, let's swap the first two letters of every capitalized word:

Find "([A-Z])([A-Z])([A-Z]*)"
Replace With "\2\1\3"

If our document has the text:

"RED red GREEN green BLUE blue"

After running our expression, we should see:

"ERD red RGEEN green LBUE blue"

Hope this helps.
User avatar
Matze
Posts: 170
Joined: 2004-12-14 07:54:49
Location: Düsseldorf Germany
Contact:

Post by Matze »

martin wrote:
Hope this helps.
Hi Martin,

yes it does, thank you.

Where should I have found that \0 expression?

In the Power Find Browser you don't find an expression for Found, just For Found 1-10. Why don't you list the Found \0 there?

For Found in the Search Field the Browser says:

> PowerFind Pro: ()

Description:
This will cause the matched text to be available as one of the 'Found' items either later in the search string or in the replace string. This expression is valid only in the search string, not in the replace string.<

This explanation I find a bit irritating.

And why don't you name Found \0 in the Search Field as well?
(In NWClassic Found was &, either in Search or in Find)

Best Matze[/url]
Post Reply