I want to write a program which checks if a string starting with a given number.
Lets say, we have a string: line = "5p.m. its a lovely time for tea!" and
then I read a number from user: num = raw_input() and want to check if
my line starts with a number that user passed.
I want to do something like (here might be some mistakes):
s = compile(r"^[\<%\>]", num)
m = s.search(line)
or
s = compile(r"^[\<%\>]", num)
m = s.search(line)
and when user pass a 5, it will print "OK" or something like that when line starts with 5, or "Its not OK" when my line starts with a different number. Im very newbie in this whole regex thing, please, help :) I accept code both for C++ and Python ;)