Sign in to follow this  
Followers 0
golfinhu

stringregexp

7 posts in this topic

people, please help me!

wath's wrong?

$regular = StringRegExp($text, "(\d|[012]\d|3[01])/(\d|1[012])/\d{4}", 3)

i need this return dates on format DD/MM/AAAA

thanks a lot!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <Array.au3>
$text = '31/12/2000 and 02-02-1234 and 12/12/2001'
$regular = StringRegExp($text, "([0123]\d)/([01]\d)/(\d{4})", 3)
_ArrayDisplay($regular)

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

this code is returning the date broken

31

12

2000

12

12

2001

... =[

Share this post


Link to post
Share on other sites

Oh, I thought that the output should be separated.

Just remove the () and then all should be in one

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

ah I understand, the autoit returns the values separated by groups, $1 $2 $3

I do it is to return the general?

but it worked, thank you

thanks!

Edited by golfinhu

Share this post


Link to post
Share on other sites

ah I understand, the autoit returns the values separated by groups, $1 $2 $3

I do it is to return the general?

but it worked, thank you

thanks!

Sorry, I don't understand whether there is still a question left.

If you do it this way (without the brackets( ) ) then you 'll get the date ich one string like 12/11/2000

#include <Array.au3>
$text = '31/12/2000 and 02-02-1234 and 12/12/2001'
$regular = StringRegExp($text, "[0123]\d/[01]\d/\d{4}", 3)
_ArrayDisplay($regular)

Depends on what you want :-)

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

i've done!

the final code!

$regular = StringRegExp($text, "\b(?:\d|[012]\d|3[01])/(?:0?\d|1[012])/(?:\d{4})", 3)

but his help was very helpful!

thankyou so much!

Edited by golfinhu

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
Sign in to follow this  
Followers 0