I have read several tutorials on regex and have tried online regex tester, but can't seem to figure out the appropriate regex for the matches I'd like it to fire on.
I'd appreciate help in creating a regex that results in true when
- the given string contains "AI [num]" where [num] is an integer. There can be anything in front or after this, even "DAI 5b" should match. However, the given string should not return true when it contains "AI 2", again with anything in front or after this allowed.
- if none of these situations are the case, it should return false
This would mean that
- "blabla blabla" => false
- "blabla AI 6" => true
- "blabla AI 4b" => true
- "blabla AI 2" => false
- "blabla AI 2b" => false
- "blabla AI 6 blabla AI 2b" => false
I really hope someone could point me in the right direction!