Regular Expression specific to a particular message pattern : As I'm pretty new to Regular Expression, I'm looking for a regular expression which will validate whether entire string is separated by '|' and there will be values with '$' followed by an integer. 

Valid Values: 

ABC=$2|CDE=$1|Msg=$4|Ph.No=$3|TIME=$5

ABC=$2|CDE=$1|Msg123=$4|Ph.No=$3|TIME_23=$5

abc=$2|123=$1|cfg=$4|Ph.No=$3

Invalid Values: 

ABC=$2CDE=$1Msg=$4

ABC=2|CDE=1|Msg123=$4|Ph.No=$3|TIME_23=$5

abc$2|123$1|cfg$4|Ph.No=$3

Msg123=$ |Ph.No=$ |TIME_23=5

abcdefgh|1234|eghjik

Msg123=$*|Ph.No=$()|TIME_23=$5

Msg123=$a|Ph.No=$b|TIME_23=$c