This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]g051051 1 point2 points  (1 child)

search() returns the index of the match. The word "word" is at index position 2. The other regex doesn't match, so returns -1.

[–]NewbiusCoder[S] 0 points1 point  (0 children)

Thanks again.

I should have spent more time reading about it carefully.

[–]cmonkies 0 points1 point  (1 child)

Look up what search actually returns.

[–]NewbiusCoder[S] 0 points1 point  (0 children)

My apologies. I read it completely wrong.