Publishing Location Scheme - replaceAll - replacing a question mark

Hi, I’m having trouble replacing a question mark in a publishing location scheme I’m trying to set up. I’ve got a string and I want to replace any question marks (and other specific characters) in that string. The following expression works when I don’t refer to the question mark…

$filename.replaceAll(’/’, ‘’).replaceAll(’\’, ‘’).replaceAll(’:’, ‘’).replaceAll(’,’, ‘’).replaceAll(’*’, ‘’).replaceAll(’&’, ‘and’).replaceAll(’ ', ‘_’).trim() + ‘.aspx’

However as soon as I add .replaceAll(’?’, ‘’) to the expression it no longer works, any ideas on how I can overcome this issue?

Thanks, George

The replaceAll() method of java.lang.String uses regular expressions. A question marks has a special meaning in regular expressions, hence to match a question mark you need to escape it by preceding it with a backslash.

Thanks, works fine now!