Confused about lesson question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Confused about lesson question

I am confused as to why \AS...\b.\Z should match 'SPAM!' in search. I understand the \A looks for the beginning and the S is there so that's a match, and what the \b does it ok, but since there is a '.' and not '!' at the end, then how come \Z is matching '.' and '!' ?? Totally lost.

25th Sep 2020, 5:09 AM
Nassim Abed
Nassim Abed - avatar
2 Answers
+ 3
. is used to match anything (character/space). And ! Is used to say the last letter of string
25th Sep 2020, 5:44 AM
Divya Mohan
Divya Mohan - avatar
+ 1
Hi Nassim, i recommend you this ressource: https://regexr.com/ It helps to work on your regular expressions and also has a cheat sheet, where you can find all the character classes. Have a nice day!
25th Sep 2020, 6:46 AM
Zen Coding
Zen Coding - avatar