message is assigned to the variable chunk for exampleon the first iterationi is and chunk is assigned message[ : (that isthe string 'call me at 'on the next iterationi is and chunk is assigned message[ : (the string 'all me at 'in other wordson each iteration of the for loopchunk takes on the following values'call me at 'll me at 'all me at ' me at -and so on you pass chunk to isphonenumber(to see whether it matches the phone number pattern and if soyou print the chunk continue to loop through messageand eventually the characters in chunk will be phone number the loop goes through the entire stringtesting each -character piece and printing any chunk it finds that satisfies isphonenumber(once we're done going through messagewe print done while the string in message is short in this exampleit could be millions of characters long and the program would still run in less than second similar program that finds phone numbers using regular expressions would also run in less than secondbut regular expressions make it quicker to write these programs finding patterns of text with regular expressions the previous phone number-finding program worksbut it uses lot of code to do something limitedthe isphonenumber(function is lines but can find only one pattern of phone numbers what about phone number formatted like or ( - what if the phone number had an extensionlike the isphonenumber(function would fail to validate them you could add yet more code for these additional patternsbut there is an easier way regular expressionscalled regexes for shortare descriptions for pattern of text for examplea \ in regex stands for digit character--that isany single numeral from to the regex \ \ \ -\ \ \ -\ \ \ \ is used by python to match the same text pattern the previous isphonenumber(function dida string of three numbersa hyphenthree more numbersanother hyphenand four numbers any other string would not match the \ \ \ -\ \ \ -\ \ \ \ regex but regular expressions can be much more sophisticated for exampleadding in braces ({ }after pattern is like saying"match this pattern three times so the slightly shorter regex \ { }-\ { }-\ { also matches the correct phone number format