[X] Replace with Regular Expression

Hi Florian,

an example in German:
Alt-5
Feld:
NETRADIOSTATION
Regulärer Ausdruck:
^.*$
Treffer ersetzen durch:
Jamendo

Execution examples:

  1. Field is empty — Result: Field is still empty.
  2. Field is not empty — Result: Field's content = "Jamendo"

IMHO this is a bug.

Ciao,
Andreas

Something else - why does using ".*" as expression lead to the replacement string to be inserted twice?

I'm using boost::regex as regular expression library which matches the null string when using the dot notation. My interpretation of this behaviour is, that a null string has neither a line begin ^ nor a line end $ so that the empty string isn't matched.

If the source string isn't empty, everything works as expected (also the null string isn't matched due to ^ and $).

This should now be very straightforward given the explanation above. Both the null string and the actual string are matched resulting in a duplication of the replace string.

Evil beasts, those regular expressions :rolleyes:

Is your boost::regex different from Perl Regular Expressions?
I am just curious...
I am using Perl regexp since ages now - but as you said - still surprised from time to time...

LoL

At least this won't happen in Perl regexp, because ".*" always matches the whole string, "^" (begin) and "$" (end) included...

So much more experience with mp3tag::regexp is expected from me...
:flushed:

Ciao,
Andreas

I am not happy with this explanation...

Ciao,
Andreas

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.