replaced regex with str.replace in foreachw