#NEWLINE# def check_pattern_startswith_slash( pattern ) : #NEWLINE# #INDENT# '\n    Check that the pattern does not begin with a forward slash.\n    ' #NEWLINE# regex_pattern = pattern . regex . pattern #NEWLINE# if ( regex_pattern . startswith ( '/' ) or regex_pattern . startswith ( '^/' ) ) : #NEWLINE# #INDENT# warning = Warning ( "Your URL pattern {} has a regex beginning with a '/'. Remove this slash as it is unnecessary." . format ( describe_pattern ( pattern ) ) , id = 'urls.W002' ) #NEWLINE# return [ warning ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return [ ]