Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6700529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:49:32+00:00 2026-05-26T06:49:32+00:00

Given a textbox name for example, the user requirement wants to be able to

  • 0

Given a textbox name for example, the user requirement wants to be able to do a wildcard search (such as contains, starts with, ends with).

Is it ok to accept the sql wildcard characters (‘%’ and ‘_’) as input as long as I am still using parameterized query in the backend (Java)? Effectively, allowing the user to build his own regular expression which is what the user’s requirement is all about.

Example:

  1. User types in the

    textbox = '%are%'
    
  2. This parameter is feed to the backend as such:

    public class PersonDaoImpl {
    
            public List<Person> search(String name){//name gets the value from textbox w/ sql wildcards
            Query q = mgr.createNativeQuery('select * from Person where name like :name'); //default to always use like since expecting searchkey with sql wildcards    
            q.setParameter('name', name);//gives the input from the screen
            return q.getResultList();
            } 
    }  
    
  3. The result set would include people with names ‘Waren’, ‘Jared’, ‘Clare’, ‘Blare’ as expected since user provided a regular expression.

With the SQL Parameterize Query, I can ensure that I won’t be allowing SQL Injection. This implements the user requirement for wildcard search, but perhaps does it violate anything that I may have missed?

UPDATES:
Just found out that Google allows wildcard too, from their help page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:49:33+00:00Added an answer on May 26, 2026 at 6:49 am

    Well, it violates the fact that the user needs to know (or be told) how to construct SQL “LIKE” syntax, but that’s all. You could end up with a slow query this way, in that it won’t usually be able to use an index, but I wouldn’t be concerned in terms of security or correctness.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to see the which JSP file contains the given UI element like textbox
Given say 11/13/2008 - 12/11/2008 as the value posted back in TextBox, what would
Given the URL (single line): http://test.example.com/dir/subdir/file.html How can I extract the following parts using
query = Files .Where(file => file.Fileinfo.Name.ToUpper().Contains(textBox1.Text.ToUpper())) .Take(7).ToList(); I hate asking this question, but I
Given the following Model, public class A { public string Name { get; set;
I would like to use a Validator to guarantee that a given textbox's submitted
Given a textbox: <asp:Textbox runat=server id=txtAddress1 /> This renders as something similar to: <input
Lets say i have a form which have the following : Name:TextBox Email:TextBox Age:TextBox
i have this model on mvc: public class User { public string Name {
How would you prevent the user from adding or removing lines in a TextBox?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.