Python Regular Expression

Extract Date in dd-mm-YYYY format from a string.
import re
my_string="Your birth day is on 24-12-2002"
dt=re.search("([0-9]{2}\-[0-9]{2}\-[0-9]{4})", my_string)
print(dt[1])
Output is here
24-12-2002


All String methods



plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer