I have a string which has this pattern “@@@” 0 or more times in it. I want a regex which is valid only if this pattern occurs exactly 2 times in the string.
Here some examples :
@@@ereruie@@@rherh
is valid.frfr;:060@fjfir@@@fjuh254@@@
is valid.frf@@frfe@@@frehfueh
is not valid.@@@fhreuihfeurf@@@hfurehfu@@@fr
is not valid.
How can I write that ?
^(?:[^@]*@@@[^@]*){2}[^@{3,}]$
is what I tried but it doesn’t work.