Hi I have a requirement where bunch of expressions should not be accepted which includes white spaces as well.
Below are the expressions.
PA#N<number>.<number>#ADP<number>
e.g.PA#N1.1#ADP1
PA#N<number>.<number>,<number>.<number>#ADP<number>
e.g.PA#N1.1,1.2#ADP1,2
PA#N<number>#ADP<number>
e.g.PA#N1#ADP4
PA#N<number>,<number>#ADP<number>
e.g.PA#N1,2#ADP4
PA#N<number>,<number>.<number>,<number>#ADP<number>
e.gPA#N1,2.1,3#ADP1
PA#N<number>,<number>.<number>-<number>#ADP<number>
e.g.PA#N1.1-3#ADP1
PA#N<number>,<number>.<number>-<number>.<number>#ADP<number>
e.g.PA#N1.1- 3.2#ADP1,2
PA#NUAL,AZ,AN#FOP<number>
PA#N1.1-2.1,3.1#ADP#PUSH
PA*N1.1*ADP
and if it is having any spaces at PA#<space>N<space>1<space>1#ADP
also not acceptable, but PA#N1.1...#5#SOME TEXT
(the SOME TEXT
part after last '#' with free text with free spaces are acceptable).
PA*
also not acceptable.
For all these the above conditions to be satisfied , I created a regex
PA(?!\*$)(?!([#*].*\s+).*)(?!(\*N(\d+(\.\d+)?,?)+)$)(?!([#*](U.*|T.*|(N\d+\.?\d*)-(\d+\.?\d*)|(N(\d+(\.\d+)?,?)+))){1,3}[#*]ADP).*
All the above conditions are matched with the above regex, only thing missing is PA#N1.1#5#FREE TEXT
(if we give any space between FREE<SPACE>TEXT
then it is not accepting.
If we don't give any space between FREE TEXT
like FREETEXT
then that matches with above regex.
Could anybody help to find my mistake and what would be the correct expression? I have been struggling with this 2 days.