I have a set of strings coming in as:
I want to match it into 3 columns if Site*** presents at the start and if P*** presents in the end else match all of it
I am trying
^(.*)??(Site\S\s\d+\S\d+)?(.*)?\s(P.*?)$
But it is missing
How can I do it?
Regex: PCRE(PHP<7.3)
the last part, including \s
needs to be optional to match the string without it
try
^(Site\S\s\d+\S\d+)?(.*?)((\s)P.*)?$