Disc Number action based on album title?

Hi.

Is there a way I can create an action so that when (CD1) or (CD2) or (CD3) etc is detected in the album field (for example)

Greatest Hits (CD2)

the disc number gets auto-filled with this number?

What do you mean with "auto-filled"?
Using a converter?
Using an action?

See there ...
/t/4117/1
... maybe you can adapt something.

DD.20120504.1220.CEST

I would like to click an action so the number following CDX gets put in the disc number field.

Action: Format value
Field: DISCNUMBER
Formatstring: $regexp(%ALBUM%,'^.[\s({[]?CD\s?(\d+)[]})\s]?.$','$1',0)

DD.20120504.1239.CEST

While that does appear to work, it doesn't work on albums where (CDX) isn't in the album title. Only albums with more than one disc get named with CDX. I would like the default to be 1.

Does this make sense?

For example
Be Here Now
Greatest Hits
Best Album (CD1)
Best Album (CD2)
Zooropa

etc

This is a new question.

Answer 1:
Activate Filter [F3]
Filterexpression: %ALBUM% MATCHES "^.[\s({[]?CD\s?(\d+)[]})\s]?.$"

Action: Format value
Field: DISCNUMBER
Formatstring: $regexp(%ALBUM%,'^.[\s({[]?CD\s?(\d+)[]})\s]?.$','$1',0)

Activate Filter [F3]
Filterexpression: NOT %ALBUM% MATCHES "^.[\s({[]?CD\s?(\d+)[]})\s]?.$"

Action: Format value
Field: DISCNUMBER
Formatstring: '1'

Answer 2:
Action: Format value
Field: DISCNUMBER
Formatstring:

$if($eql(%ALBUM%,$regexp(%ALBUM%,'^.*[\s({[]?CD\s?(\d+)[]})\s]?.*$','$1',0)),'1',$regexp(%ALBUM%,'^.*[\s({[]?CD\s?(\d+)[]})\s]?.*$','$1',0))

Answer 3:
Action 1: Format value
Field: DISCNUMBER
Formatstring: $regexp(%ALBUM%,'^.[\s({[]?CD\s?(\d+)[]})\s]?.$','$1',0)

Action 2: Format value
Field: DISCNUMBER
Formatstring: [$if($isdigit(%DISCNUMBER%),%DISCNUMBER%,'1')]

DD.20120504.1342.CEST