Jump to content
gcue

stringregexp to extract date from a string

Recommended Posts

hello world

instead of using stringsplit, i am trying to see if there's a way to use stringregexp to extract date from a string

$string = "12/21/2013 01:32:22 PM"

I would like to keep "12/21/2013"

thanks in advance!

Share this post


Link to post
Share on other sites

 

thanks in advance!

Hey, Thats my style :)

I am trying to learn regexp pattern's from here, Hope it Helps :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

$string = "12/21/2013 01:32:22 PM"

; $date = StringRegExpReplace($string, "^\d{2}/\d{2}/\d{4}\K.+", "")
$date = StringRegExpReplace($string, "\h.+", "")
ConsoleWrite($date)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...