Welcome to the Treehouse Community
Looking to learn something new?
sarvienn thevendran734 Points
re.search : how is this supposed to work?
in this re.search function I dont know where i can place my raw source.. as in doesn't the re.search function need a place you want it to look at? i am getting an erroe saying it is missing a positional argument
import re def first_number(expr): return re.search(r'\d',expr) def numbers(cnt,str): return re.search(r'\str' * cnt)
Jonathan GrieveTreehouse Moderator 90,719 Points
The numbers function isn't quite right. I think what you need to do there is cast the return value as a string, so you get the required number of numbers in your result.
So... the reference to
re. is simply calling the regular expression library so you can use search and match methods.
You're right to try and multiply in your return. But you just need a simple regular expression and then reference your function arguments in your call to search.
return re.search(r'\d' * cnt, str)