Android Question [Solved] Prevent entering "/" with RegexPattern

angel_

Well-Known Member
Licensed User
Longtime User
I use B4XInputTemplate and I have this:

B4X:
input.RegexPattern = ".+" 'require at least one character

How can I also prevent the user from entering "/" in the input.
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
Do you want to use Regex particularly? What about ...
B4X:
Sub test(input As String)
    If (input.Length < 1) Or (input.IndexOf("/") > -1) Then
        xui.MsgboxAsync("Input must ......", "Input error")
    End If
End Sub
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
Do you want to use Regex particularly? What about ...
B4X:
Sub test(input As String)
    If (input.Length < 1) Or (input.IndexOf("/") > -1) Then
        xui.MsgboxAsync("Input must ......", "Input error")
    End If
End Sub
Edit : Okay - I see that you do need to use Regex.
 
Upvote 0
Top