I need to find a substring in a sentence "Hello, call me XXX.". The sentence can be really long and the only thing that helps me to identify what the name is, is the fact that name is always in fromat "call me"+space+name"+dot. Nevertheless the sentence could also look like hello, call me. call me xxx.
Call me John. ⇒ John
Call me Call me John. ⇒ prohibited - confusing
Call me. Call me John. ⇒ John
Call me Call me John. ⇒ John
Call me Peter .Call me John. ⇒ John
Call me Peter. Call me John. ⇒ prohibited - more then one name...
Name can be any sequence of chars except \r, \n, \0 and a dot.
I would appreciate it If somebody could help me to define the regex. I'm trying to figure out for more than two hours but without any success...
Call me Call me John.is prohibited? According to your problem statement, it should be OK and name isCall me John. Also whyCall me Peter .Call me John.is non prohibited? There are two matches: with namePeterand nameJohn. In case name cannot contain spaces, what is the problem withCall me Call me John.? It is not confusing and name isJohn.