xXKlaskpffXx Posted June 14, 2022 Share Posted June 14, 2022 Hi, I need help. I want to check if the Input in an GUI input field contains different characters than lowercase letters, numbers, hyphens, underscores and periods. But I can't get it to work with StringInStri or StringRegExp. Can anyone help me? Link to comment Share on other sites More sharing options...
ad777 Posted June 14, 2022 Share Posted June 14, 2022 Use GuiCtrlRead iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 14, 2022 Moderators Share Posted June 14, 2022 xXKlaskpffXx, I see you did not read those rules to which I linked very carefully - you missed the part that says: "Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above" However, as this question is of general interest and not specifically game-related, we will let it stand this time. But you have used up your flex so please be more careful in future. ad777, Please reduce the height of your signature. 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 Link to comment Share on other sites More sharing options...
Musashi Posted June 14, 2022 Share Posted June 14, 2022 (edited) 3 hours ago, xXKlaskpffXx said: I need help. I want to check if the Input in an GUI input field contains different characters than lowercase letters, numbers, hyphens, underscores and periods. But I can't get it to work with StringInStri or StringRegExp. Can anyone help me? Just a hint : Local $sInput = "a...az019bc.-_" If StringRegExp($sInput, "[^a-z0-9._-]") Then ConsoleWrite("found forbidden chars" & @CRLF) Else ConsoleWrite("Input OK" & @CRLF) EndIf EDIT : @xXKlaskpffXx If you want to check the characters while typing, have a look at e.g. : preventing-invalid-characters-from-being-entered-into-an-input-control Edited June 14, 2022 by Musashi argumentum 1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
xXKlaskpffXx Posted June 15, 2022 Author Share Posted June 15, 2022 @Musashi Thanks but I want the opposite so that it checks if different characters than the ones i specified are in the string. @ad777 How can I check a string simply with GuiCtrlRead? Link to comment Share on other sites More sharing options...
xXKlaskpffXx Posted June 15, 2022 Author Share Posted June 15, 2022 @Musashi Thanks but I want the opposite so that it checks if different characters than the ones i specified are in the string. @ad777 How can I check a string simply with GuiCtrlRead? Or is there a way to invert a string so that it's like: If stringRegExp($Input, NOT "a-z0-9_.-") ? Thanks in advance Link to comment Share on other sites More sharing options...
Solution Musashi Posted June 15, 2022 Solution Share Posted June 15, 2022 (edited) 16 minutes ago, xXKlaskpffXx said: Or is there a way to invert a string so that it's like: If stringRegExp($Input, NOT "a-z0-9_.-") NOT "a-z0-9_.-" -> This is not a valid notation for RegEx. The search pattern "[^a-z0-9._-]" already excludes all characters that do not match the set "Lower case, digits, period, underscore and hyphen. The caret ^ at the beginning is the negation. Edited June 15, 2022 by Musashi typo "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
xXKlaskpffXx Posted June 15, 2022 Author Share Posted June 15, 2022 36 minutes ago, Musashi said: NOT "a-z0-9_.-" -> This is not a valid notation for RegEx. The search pattern "[^a-z0-9._-]" already excludes all characters that do not match the set "Lower case, digits, period, underscore and hyphen. The caret ^ at the beginning is the negation. Thanks and sorry for my stupidness Musashi 1 Link to comment Share on other sites More sharing options...
Musashi Posted June 15, 2022 Share Posted June 15, 2022 Just now, xXKlaskpffXx said: Thanks and sorry for my stupidness No need to apologize. Especially regular expressions can be very tricky, and I myself am far from having mastered this topic (if ever) . "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
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