Find (complex) Text in the .txt file

Acctually i want to search some text in the text file for example there are many text in this

file some text are givn below

PWK*EB*EL***AC*28388,28389,28390~
AMT*F5*7.09~
REF*D9*9991901628387~

there are some text which is repeat many times in the files like

"PWK*EB*EL***AC*28388,28389,28390~" and REF*D9*9991901628387~
there is some constant like

"PWK*EB*EL***AC*" < this is constant > "~" this is the ending symbol
and
"REF*D9*" < this is constant > "~" this is the ending symbol
this means that line stats with "PWK*EB*EL***AC*" and end with "~"


now

i want to get all these numbers which is in between these constant PWK*EB*EL***AC*......~ and

REF*D9*.............~

PWK*EB*EL***AC*28388,28389,28390~
AMT*F5*7.09~
REF*D9*9991901628387~

1)These numbers i want
-
a)28388,28389,28390,.....,n (NOTE: there may be 1 or n numbers in (a))

b)9991901628387

2)
now the condition is to compare last 5 numbers of (b) that is 28387 to the all numbers of (a)
(b) must be less then the above number that is (a)

Example:

28387<28388
28387<28389
28387<28390
...
...
n
if the reverse situation the file log file generate which include the line number or text which

is less the then (b)
For example

-
INVALID TEXT

PWK*EB*EL***AC*28384,28385,28386~
AMT*F5*7.09~ (This is some other text in the file)
REF*D9*9991901628387~
--
THANKS

[1627 byte] By [AtherAbbas] at [2007-12-24]
# 1
Take a look at regular expressions.
KenTucker at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...