Regular Expressions

Does anyone know any good tutorials for the regular expressions feature as relating to Opus?

Unless someone beats me to it I plan to submit a regex tutorial here within a month or so. The only reason it might take that long is because my current workload is pretty intense and doesn't leave me a lot of free time.

Meanwhile the DOpus help files on RegExp provide a pretty good springboard.

John

ok, i think i figured out some stuff by reading some of the other post here, including yourself. :astonished:)

i've run across the following problem though.

A question about regular expressions.

Old expression:
(.) ([0-9]+) (.)

New expression
\2 \3

The following file:
Winamp Remix 'now listen' - 05 - musica negra (black music accepella).mp3
becomes
05 - musica negra (black music accepella).mp3

and that's all good. However, the following file

Winamp Remix 'now listen' - 06 - the taking of pelham 123 (end title).mp3
becomes
123 (end title).mp3

How can I fix the syntax so I get:
06 - the taking of pelham 123 (end title).mp3
in the second case? It's spun out because of the 123, right? :astonished:

Try this instead:

(.) ( - [0-9]+ - ) (.)

I tried it, but the expression did not work until the spaces were adjusted a bit. :slight_smile:

(.) (- [0-9]+ -) (.)

So I guess the Minus just stops the + repeat operator?

why have a minus at the start? doesn't the ^ do the same thing?

:slight_smile:

I tried it, but the expression did not work until the spaces were adjusted a bit. :slight_smile:

(.) (- [0-9]+ -) (.)

So I guess the Minus just stops the + repeat operator?

why have a minus at the start? doesn't the ^ do the same thing?

:slight_smile:

No, the - is simply a minus, it has no special significance here. Nudel used it because in your example you have a - on each side of the key thing to search for which is 06

You could start the regex search criteria with a ^ but in this case it really isn't necessary.

You could also use:

old name
^(.-) ([0-9]+ -.)

new name
\2

John

lol - guess i got the reasoning completely back to front! :smiley:

Thanks for the clarification & explanations chaps! Much appreciated. :slight_smile: