Questions tagged [user-input]

User Input is data that the user inputs into the program. It generally takes the form of a String, but may also be an integer, floating-point number, etc.

5580 questions
16
votes
6 answers

Is it safe to use user input for Python's regular expressions?

I would like to let my users use regular expressions for some features. I'm curious what the implications are of passing user input to re.compile(). I assume there is no way for a user to give me a string that could let them execute arbitrary…
Skeletron
  • 233
  • 3
  • 7
16
votes
3 answers

Lightweight GNU readline alternative

I am looking for a GNU readline alternative. It comes with a lot of features but only couple of them are useful to me as explained below - I am working on a interactive command prompt application (display prompt and accept next user command to be…
punekr12
  • 653
  • 2
  • 7
  • 14
15
votes
12 answers

What's the best approach to get Date/Time input from the user?

This is a wheel that's been re-invented again and again over the years. The Problem: The user needs to input a Date/Time Basic considerations We want to make it as easy as possible for the user to enter the desired date/time Some applications call…
Ryan
  • 9,918
  • 7
  • 42
  • 57
15
votes
4 answers

Get user input from a textbox in a WPF application

I am trying to get user input from the textbox in a WPF application I am building. The user will enter a numeric value and I would like to store it in a variable. I am just starting on C#. How can I do it? Currently I am opening the textbox and…
crossemup
  • 351
  • 1
  • 3
  • 9
15
votes
5 answers

How can I safely use regexes from user input?

My (Perl-based) application needs to let users input regular expressions, to match various strings behind the scenes. My plan so far has been to take the string and wrap it in something like $regex = eval { qr/$text/ }; if (my $error = $@) { #…
user240438
15
votes
6 answers

How to scanf only integer and repeat reading if the user enters non-numeric characters?

Here is some C code trying simply to prevent the user from typing a character or an integer less than 0 or more than 23. #include #include int main(void) { const char *input; char *iPtr; int count = 0; int…
7kemZmani
  • 658
  • 1
  • 8
  • 21
14
votes
5 answers

What is the easiest way to get an int in a console app?

I want to process user input as an integer, but it seems as though C has no way to get an int from stdin. Is there a function to do this? How would I go about getting an int from the user?
Jon Chasteen
  • 143
  • 1
  • 1
  • 5
14
votes
6 answers

Converting user-entered search query to where clause for use in SQL Server full-text search

What's the best way to convert search terms entered by a user, into a query that can be used in a where clause for full-text searching to query a table and get back relevant results? For example, the following query entered by the user: +"e-mail"…
Mun
  • 14,098
  • 11
  • 59
  • 83
14
votes
2 answers

How can I get user input without waiting for enter in Perl?

I am trying to make an interactive shell script in Perl. The only user input I can find is the following: $name = ; print STDOUT "Hello $name\n"; But in this the user must always press enter for the changes to take effect. How can I get…
john-jones
  • 7,490
  • 18
  • 53
  • 86
14
votes
2 answers

PHP - Is this a safe way to allow user-supplied regular expressions

I would like to allow small user-defined regular expressions to be submitted for testing. However, there are many problems to consider from run-away server usage to more evil eval() usage. To my knowledge I have handled all the problems I could…
Xeoncross
  • 55,620
  • 80
  • 262
  • 364
14
votes
1 answer

How to throw std::invalid_argument error?

I have an overloaded operator in my Fraction class in C++ which is designed to take input from standard input in the form of an integer over an integer i.e. 1/2 or 32/4 and initialize a Fraction object based off of those values. It works, but I'm…
michaelsnowden
  • 6,031
  • 2
  • 38
  • 83
14
votes
2 answers

How do I read custom keyboard shortcut from user in WPF?

In my application, I want to let users customize keyboard shortcuts, just like it's done in Visual Studio's keyboard options. The user can focus a blank text box and then type any shortcut he wants to assign to a command. The closest I've come to…
Anthony Brien
  • 6,106
  • 7
  • 43
  • 56
14
votes
11 answers

How to get input from user at runtime

I want to take runtime input from user in Oracle 10g PL/SQL blocks (i.e. interactive communication with user). Is it possible? declare x number; begin x=&x; end this code gives error as & can't be used in oracle 10g
Ravindra Bagale
  • 17,226
  • 9
  • 43
  • 70
13
votes
9 answers

Manual input from user while running selenium IDE script

can user is able to give manual input while running selenium IDE script? For ex. If there is name field then can we open input box everytime script runs so that user can give his input for name field? Let me know whether it is possible or not.. If…
Rohit Ware
  • 1,982
  • 1
  • 13
  • 29
13
votes
4 answers

HTML - How to prevent user from editing form's value?

I am developing a simple web apps that allowed user to key in information using a form when I discovered I could edit that form's input default value using Chrome -> Check Element and submit the page with a different hacked value. Code:
maomaopop
  • 290
  • 1
  • 4
  • 19