Jump to content

How to filter GUI Input


Go to solution Solved by Musashi,

Recommended Posts

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
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 by Musashi

Musashi-C64.png

"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 post
Share on other sites
  • Solution
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 by Musashi
typo

Musashi-C64.png

"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 post
Share on other sites
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

Link to post
Share on other sites
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) :lol:.

Musashi-C64.png

"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 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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...