/ bb | [^ b] {2} / how does it work?

Can someone explain? I read this on a t-shirt :

enter image description here

He seems to be saying, "To be or not to be."

How? I don’t seem to find the "e" ?: P

How exactly is this regex / geeky?

+6
source share
3 answers

Assuming # for comments:

/ bb # two b's | # or [^ # not b]{2} # two b's / 
+12
source

Unfortunately, the correct description would be: "two b or not b, not b" ​​or "two b and two not-b" (which really doesn't come close to "to be or not to be").

 /bb|[^b]{2}/ => /bb|[^b][^b]/ 

Of course, β€œtwo b or not two b” matches anything if they are expressed in a regular expression!

+8
source

Read it out loud: "BB, or not B, not B". Or: "Two B, or not two B". Hmm ... not sure if someone wants to check the letter B, I think.

0
source

Source: https://habr.com/ru/post/892516/


All Articles