re search(function will search the regular expression pattern and return the first occurrence unlike python re match()it will check all lines of the input string the python re search(function returns match object when the pattern is found and "nullif the pattern is not found in order to use search(functionyou need to import python re module first and then execute the code the python re search(function takes the "patternand "textto scan from our main string the search(function searches the string for matchand returns match object if there is match if there is more than one matchonly the first occurrence of the match will be returnedexamplesearch for the first white-space character in the stringimport re txt "the rain in spainx re search("\ "txtprint("the first white-space character is located in position:" start()outputthe first white-space character is located in position the split(functionthe split(function returns list where the string has been split at each matchexamplesplit at each white-space characterimport re txt "the rain in spainx re split("\ "txtprint(xoutput['the','rain','in','spain'