lineinfile single quotes in regexp

hallo,

i need to uncomment this statement :

   # 'Mirroring',

in gitolite.rc .

The problem is that ‘Mirroring’ contains quotes.

  • { regexp: ‘^(\s*)#? *('Mirroring,')’, line: “‘Mirroring’,” }

when i run the task containing this regexp i get this syntax error:

The offending line appears to be:

  • { regexp: ‘^(\s*)#? *('Mirroring,')", line: "‘Mirroring’,’ }
    ^ here

Had the same problem not long ago. Escaping here works with doubling the single quote.

exactly! Thanks for replying :slight_smile:

Inside single quotes, you can represent a single quote in your string by using two single quotes next to each other.