$regexp(x,e,r,c)

"in the string x by r".
Sorry for being so dim, but this has baffled me, "by r" what does this mean? What should I be replacing r with?

Some examples here would go a long way to helping your users out.

replaces the pattern specified by the regular expression e in the string x by r. The optional fourth parameter c enables ignore case (1 ) or disables the ignore case setting (0 ). Please note that you have to escape comma and other special characters in e.

The pattern that has been described in the parameter "x" is replaced with/by that what is stated in the parameter "r".
In a simple replace "water" would be replaced by"wine".

Thank you ohrenkino.

Yes, "with" would be the right word most people would use!
Anyway...
I have $regexp(%_directory%,\W\s\D,r,c). This picks up JAS 02 from the directory "JAS 02 - ...." and placing it in the comment field and I would like it to be JAS02.
I'm still working on the rest of this action. But this one bit puzzled me!

Could you give the real source string with all the bits and tell us what the result should be?
Right now the "r,c)" part does not look right.

It incomplete, but...
I'm doing two things here, formatting the comment and then moving the file.

It may be best to say what I'm aiming for.
My directory's names are:
JAS 04 - artist - album
JAS 204 - artist - album
JAS 205 - artist - album

I want to copy JAS 04 to the comment field adding "Jasmine Records No. ", but without the space "Jasmine Records No. JAS04".

Format value "COMMENT" Jasmine Records No. $left(%_directory%,6)
Then a replace "JAS " with "JAS".

For the move the below works, but I have to moving the rest of the contents of the folder manually.
W:_JASMINE$left(%_directory%,3)~$right(%comment%,3) = %artist% - %album% $if($neql(%_extension%,mp3),{FLAC},{@ 320})%track% = %artist% - %title%

I've read that this may be not a one ling job, so the directory structure I'm after is
W:_JASMINE\JAS~04 = Duke Ellington - Duke meets coleman {FLAC}\the files

My workings so far....
$left(%_directory%,3)~$right(%comment%,3) = %artist% - %album%
$if($neql(%_extension%,mp3),{FLAC},{@ 320})

$left(%_directory%,3)~$right(%comment%,3) = %artist% - %album% $if($neql(%_extension%,mp3),{FLAC},{@ 320})%track% = %artist% - %title%

EDIT
Done this a TAG to Filename.

You could modify that
Format string: Jasmine Records No. $replace($left(%_directory%,6), ,)

Doh! of course I can, silly me. Thank you.

I've been reading post HERE Move folder.jpg along with MP3 files to new directory

I think I was trying to do to much in one line.
So now i do the copy to comment,
then the file rename,
then the move.

Jasmine Records No. $replace($left(%_directory%,6), ,)

%track% = %artist% - %title%

W:_JASMINE$left(%_directory%,3)~$right(%comment%,3) = %artist% - %album% $if($neql(%_extension%,mp3),{FLAC},{@ %_bitrate%})\

And this works.

So was my understanding of the regex thing incorrect?

EDIT

I was trying the regex so that it would cover these directories (added the dash)
JAS 03 - ...
JASM 1034 - ...
JASMCD 3077 - ....

Anyway thank ohrenkino.

To extract the leading string without space:
$regexp(JASMCD 3077 - artist - album,(.*?) (\d+) - .*,$1$2)
(I used this as an example string - the real thing would probably be:)
$regexp(%_directory%,(.*?) (\d+) - .*,$1$2)

Oh I see where I was going wrong now.

I should have been using capture groups and the r was referring to the capture groups I wanted t keep. Makes sense now.