Syl21 Posted August 19, 2009 Posted August 19, 2009 (edited) Data in excel: Engineer 01082009000000 02082009000000 03082009000000 Contact Numbers Base AutoIt Script: $sCellValue=_ExcelReadCell($oExcel, $LIGNEDATE, $Colonne) $test= StringRegExp ( $sCellValue, '[:digit:]{14}' ) MsgBox(0, "Error!", "debut"&$sCellValue&"fin donc resulat= "&$test) $test always send "0" I want $test="1" when data is like 02082009000000 Can you help me??? I don't know why that doesn't work... Thanks in advance Edited August 19, 2009 by Syl21
Syl21 Posted August 19, 2009 Author Posted August 19, 2009 I have found my solution: $test= StringRegExp ( $sCellValue, "\d{14}" ) I don't know why [:digit:] don't work... If somebody know...
Moderators Melba23 Posted August 19, 2009 Moderators Posted August 19, 2009 (edited) Syl21,I believe you need to use another set of [] when you use character classes:$value = "02082009000000" If StringRegExp($value, "[[:digit:]]{14}") = 1 Then ConsoleWrite("Hit" & @CRLF)Or you could avoid any [] by using:$value = "0208200900000" If StringRegExp($value, "\d{14}") = 1 Then ConsoleWrite("Hit" & @CRLF)And finally, as _ExcelReadCell returns a string, you could even use boring old string functions:$value = "02082009000000" If StringLen($value) = 14 And IsInt(Number($value)) Then ConsoleWrite("Hit" & @CRLF)M23Edit: I see you beat me to it! >_< Edited August 19, 2009 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Syl21 Posted August 19, 2009 Author Posted August 19, 2009 Syl21, I believe you need to use another set of [] when you use character classes: $value = "02082009000000" If StringRegExp($value, "[[:digit:]]{14}") = 1 Then ConsoleWrite("Hit" & @CRLF) Or you could avoid any [] by using: $value = "0208200900000" If StringRegExp($value, "\d{14}") = 1 Then ConsoleWrite("Hit" & @CRLF) And finally, as _ExcelReadCell returns a string, you could even use boring old string functions: $value = "02082009000000" If StringLen($value) = 14 And IsInt(Number($value)) Then ConsoleWrite("Hit" & @CRLF) M23 Edit: I see you beat me to it! >_< Thanks for your answer Fu...ng Bracket lol Have a good day
Syl21 Posted August 19, 2009 Author Posted August 19, 2009 How can i edit my post to write RESOLVE inside??? thanks in advance
Moderators Melba23 Posted August 19, 2009 Moderators Posted August 19, 2009 Syl21,Edit your first post, but when the editing screen comes up, press the "Use Full Editor" button. You can then edit the title as well as the text.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now