#Japt, 16 14 bytes
Japt, 16 14 bytes
Ëc^#(*(D>V©øT°
Ë>V©øT° ?Dc^#(:D :Implicit input of multi-line string U & integer array V
Ë :Map each D in U
>V : Greater than V? (Coerces V to a string and, conveniently, all digits are > "\n" & "-" and < "^" & "v")
© : Logical AND with
ø : Does V contain
T° : T (initially 0) postfix incremented
? : If true
Dc : Charcode of D
^#( : XOR with 40
:D : Else D