I am trying to match everything except * or ** or infinity number of *
I have already writed such regex:
^(?!\*).+$|^.*[^\*]$|(?<=\*).+
I need to add or statement which would remove match: '****' Or write entire new one which:
Should not match when *
Should not match when **
Should not match when ***
ect.
Should match when A9()*
Should match when *A9()
Should match when A(*
Should match when A*()*
Should match when A9*)
Should match when A9()
ect.
Live example: https://regex101.com/r/pw2z9E/1
You can use length operator to determine minimum length of each symbol. For example:
(\w{1,}\*{1,}|\w+)
UPD
To include special characters use this modifications:
([^*\s]{1,}\*{1,}|[^*\s]+)
This one is working, thanks
@KamilSocha91 just updated the answer