regex to capture a character followed by itself or other specific characters in a single group
I am trying to handle a code where comments can be designated with !
, !!
, or !>
.
I want to match all of these possibility in a single group but am having difficulty as whatever I try so far might match the !
in !!
or !>
etc. as a separate entity.
Example: regex101.com/r/u0vMY6/2
If anyone can help with this that would be great and help me to make progress.
More specifically I want to do this with the overall objective of matching when there are 0 or 2+ spaces after the comment deliniator followed by a word.
I have an summary of what I am trying to achieve here: regex101.com/r/u0vMY6/4
If needed I could perhaps break it down into multiple checks.
I’m not very experienced with regex but have read various cheatsheets and stackoverflow questions without finding a solution yet. Any help is appreciated.
Read more here: Source link