I know this sounds easy but I am stuck.
I want to match strings that has asterisk *
.
Essentially I want to allow strings having asterisk at front/back/both but not middle:
(At max there will be 2 asterisks, front and both but no middle, and the presence string is a must)
ALLOW:
*string*
*string
string*
string
DENY:
*str*ing*
*str*ing
str*ing*
str*ing
*string**
**
*
I tried
^\\*?((?!\\*).)*\\\*?$
and somehow it works.
Can someone explains how this works?
And verify if this is correct because regex..hard to debug and check..