I am trying to match a regex pattern for a JCL job statement Which can come in the below formats
//jobname JOB
//jobname JOB AccountInfo,'PGMR name',keyword=param,keyword=param,keywod=param
//jobname JOB ,keyword=param,keyword=param
//jobname JOB (Accountinfo)
//jobname JOB 'pgmrname'
//jobname JOB accountinfo
The structure is explained below
//name job > mandatory fields
Account info is optional and can exiting in two day accountinfo or (accountinfo)
PGMR name is optional and looks like this 'myname'
key word parameters optional and will be in pairs MSGCLASS=1,CLASS=P
Looking for matching the regex to match above all optional combination
I have tried using ?= if then else condition but not working regex used in given below
\/\/\w+\s+JOB\s+(?:(?=(\w+|'\w+')(,\w+)|\w+))?(,(\w+=\w+))$
visualization of rgex conditon
Visalization of my regex is given above
Matching and non matching strings are given in below trail demo Not able to achieve the required result. https://regex101.com/r/CdpB9c/2