thank you all so much for replying it works now AND - maybe even more important - i do understand WHY it works... i can't recall the '?:'-thing mentioned in "programming ruby" - this could be a worthy extension to the book. maybe i just didn't see it - well... the whole \-thing is annoying me anyway - maybe the solution of warren is the best - converting all '\' to another thing that would never occur under normal circumstances and then re-substitute it after matching. finally a word on why i asked this stuff - i wasn't just bored: we're doing a PHP-project in school, it's now rather big with about 100 PHP-files of which i guess at least 80 have echo-calls in it. we notized (much too late), that the standard-echo in PHP does not convert some characters to their appropriate HTML-whatever-this-is-called (for instance the euro-sign should be €). so we wrote a new function called secho, which accepts ONE string as parameter - not a combination out of strings and varnames (i.e. $var) - and there, the problem started: how to convert the echo-calls to correct secho-calls??? i had the questionable honour to work out a solution for this - a good chance to brush up my ruby-skills. now i have a script iterating over all PHP-files in our project-directory (and it's subdirectories, hehe...) and changing each echo to a secho - even the most "complicated" case: echo "foo" $bar "\"foobar\""; gets converted to secho("foo".$bar."\"foobar\""); (the '.' is the PHP string-concat-operator) thanks again to the people that helped me out with that, greetings from austria, patrick