hi guys,
thanks to the help with my previous homework question Regex to match tags like <A>, <BB>, <CCC> but not <ABC>
, but now i have another homework question.
i need to match tags like <LOL>
, <LOLOLOL>
(3 uppercase letters, with repeatable last two letters), but not <lol>
(need to be uppercase).
using the technique from the previous homework, i tried <[A-Z]([A-Z][A-Z])\1*>
. this works, except there's an additional catch: the repeating part can be in mixed case!!!
so i need to also match <LOLolol>
, <LOLOLOlol>
, because it's 3 uppercase letters, with repeatable last two letters in mixed case. i know you can make a pattern case-insensitive with /i
, and that will let me match <LOLolol>
with the regex i have, but it will also now match <lololol>
, because the check for the first 3 letters are also case-insensitive.
so how do i do this? how can i check the first 3 letters case sensitively, and then the rest of the letters case-insensitively? is this possible with regex?
thanks!