We can use wish or if only (more dramatic) to express a wish, hope or regret, depending on the tense used.
Were is more often used instead of was after these words.
Take a look at the table and some examples: