How can I match the start and end in Python’s regex?

How about not using a regular expression at all?

if string.startswith("ftp://") and string.endswith(".jpg"):

Don’t you think this reads nicer?

You can also support multiple options for start and end:

if (string.startswith(("ftp://", "http://")) and 
    string.endswith((".jpg", ".png"))):

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)