Hi Flo,

Don has already answered your question. But let me put my own spin on it.

When NoteTab parses the function which takes its input ("$1") and modifies it by adding spaces. In other words, the function passes the literal string '$1' through, along with the additional spaces.

So the regular expression sees the output of the function:

" $1 "

which is a perfect pattern, into which to insert each group content.

i.e. (used monospaced text to align the before and after):

" $1 " becomes:

" 234 data "

Your example with StrCopy works exactly the same way. StrCopy copies up to the 4 characters you told it to copy, and passes them to the regular expression. Since the string contains only "$1" it passes that out to the regexp engine, which sees it as a replacement token.

(1) --> "$1 plus" --> "1 plus"

(12) --> "$1 plus" --> "12 plus"

(234)--> "$1 plus" --> "234 plus"

One more thing. Suppose the str function is in the search pattern. It too will only get parsed once, and the result passed to the regexp engine. However, most of the time you will probably not have a group passed into the function to confuse the issue.

Though you could (using \1).

Cheers,

Eb

--- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:

>

...

> > NoteTab will parse the StrAling function only once...

the dingaling wrote stringaling

>

> Eb, I've got some problems with that explanation. Let's look at...

>

> ^!Replace "^(\d+) " >> "^$StrAlign("$1";5;Right)$ " RAWS

...

> On the other hand, if we look at...

>

> ^!Replace "^(\d+)" >> "^$StrCopy("$1";1;4)$ plus" WARS

>