You are viewing a single comment's thread. Return to all comments →
. usually means any character. Some regex engines omit end of lines (\n and \r) when using ..
.
\n
\r
The start * next to it mean "as much that can be matched".
*
So .* means "match as much of any character".
.*
The whole stuff : .*h.*a.*c.*k.*e.*r.*r.*a.*n.k. means "match as much of any characters between lettres of hackerrank".
.*h.*a.*c.*k.*e.*r.*r.*a.*n.k.
You may see someday something like that : .*? which basically means "match as few as possible any character". It's called "non greedy".
.*?
Regexp are a very powerfull tool. Automata too. Challenge: figuring out why I wrote "Automata too"!
HackerRank in a String!
You are viewing a single comment's thread. Return to all comments →
.
usually means any character. Some regex engines omit end of lines (\n
and\r
) when using.
.The start
*
next to it mean "as much that can be matched".So
.*
means "match as much of any character".The whole stuff :
.*h.*a.*c.*k.*e.*r.*r.*a.*n.k.
means "match as much of any characters between lettres of hackerrank".You may see someday something like that :
.*?
which basically means "match as few as possible any character". It's called "non greedy".Regexp are a very powerfull tool. Automata too. Challenge: figuring out why I wrote "Automata too"!