gexp regular expression problems

Hi,

I apologize if this isn't posted in the right place. I must be doing something horribly wrong, but I can't see it.

I'm trying to use regexp in an action to edit directory names to produce an Album name. The following is my test case:

"2005 - The Cellar Door Sessions 1970 (Live) [6CD]\CD1".

I want to remove the string " [6CD]", but in a general way so the 6 could be any 1 or 2 digit number. I started with:

$regexp(%_parent_directory%,\s[\d{0,2}CD],,0), which resulted in:

REGEXP ERROR: Regular expression Invalid or trailing backslash

I've tried the following expr strings, with the noted results:

'[6CD]' 2005 - The ellar oor Sessions 1970 (Live) []

[\d{0,1}CD]

          REGEXP ERROR: Regular expression Invalid or trailing backslash

[[0-9]{0,1}CD]

          REGEXP ERROR: Regular expression Invalid or trailing backslash

[[0-9]CD]

          REGEXP ERROR: Regular expression Invalid or trailing backslash

'['[0-9]CD']'

          2005 - The ellar oor Sessions 1970 (Live) [6]

'[' REGEXP ERROR: Regular expression Unmatched [ or [^

[ [ SYNTAX ERROR IN FORMATTING STRING ]

I don't know how to get the special characters working, or what I might have done to disable them. This is my first attempt with regexp in an Action, so maybe I haven't turned something on?

  • Terry

$regexp(%_parent_directory%,\s'['\d{0','2}CD']',,0)
or
$regexp(%_parent_directory%,'\s[\d{0,2}CD]',,0)

Thanks. I never received an email alert on your reply, but figured out your second suggestion (single quotes around the whole string) working a different problem.