Escape Quote in RegExp

How do I escape a single quote in regexp? These attempts don't work:

$regexp(%title%, '[_#\']',)
$regexp(%title%, '[_#'']',)

In this case it would probably be
`$regexp(%title%, '[_#''']',)
It is 2 apostrophes to escape one and then you have 2 strings in apostrophes, one to the left and one to the right of the escaped character.

I copied and pasted that into the column value:

$regexp(%title%, '[_#''']',)

The column shows this:

[ SYNTAX ERROR IN FORMATTING STRING ]

Try this:
$regexp(%title%,'['_#''']',)

2 Likes

That works! Thanks! Can you explain how/why that works?

See "Characters with special functionality" here: https://help.mp3tag.de/main_scripting.html

  • '['_#''']'
    1. [
    2. _#
    3. '
    4. ]
  • '[_#''']'
    1. [_#
    2. '
    3. ], followed by an unmatched apostrophe
  • '[_#'']'
    1. [_#
    2. ]

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