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 9300073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:42:08+00:00 2026-06-18T22:42:08+00:00

i need to search for and of these ! @ # $ % ^

  • 0

i need to search for and of these ! @ # $ % ^ & * ( ) '\ symbols in within a field content sqlite database, i am using the following sql string

Select ID From Tasks Where '--' || tasks || '--' ||  note || '--'  like '%! @ # $ % ^ & * ( ) ""%' 

or i tried this

Select ID From Tasks Where task LIKE '[!] [@] [#] [$] [%] [^] [&] [*] [(] [)] ''%'

but the search does not return any result. For the field task some of the content are

  1. Today's tasks or

  2. here are some wildcards ! @ # $ % ^ & * ( ) ' or

  3. Some brakest are [ ] { } ( )

so if i search item one as a whole, i should get it or if i search for ! @ # $ % ^ & * ( ) ', i should get item 2. etc

if i serah within the field passing some of the wildcards within the text or all in the same order, i should get the row contain the value

I know some of the symbols have meaning in sqlite sql, so how do i escape all or any of these characters in an sql query string

  • 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-06-18T22:42:09+00:00Added an answer on June 18, 2026 at 10:42 pm

    First, strings in SQL are enclosed in single quotes; if you want to write a string containing single quotes, you have to escape them by doubling them:

    SELECT ID FROM Tasks WHERE task = 'Today''s tasks'
    

    To avoid this, most languages allow you to use parameters:

    db.execute("SELECT ID FROM Tasks WHERE task = ?", [ "Today's tasks" ])
    

    Second, the LIKE operator interprets the % and _ characters specially.
    To use these characters without their special meaning, you can use the ESCAPE clause to specify a character that escapes %, _, and itself:

    SELECT ID FROM Tasks WHERE task LIKE '%! @@ # $ @% ^ & * ( ) ''%' ESCAPE '@'
    

    This escaping is completely independent from the SQL string quoting; you stil you have to use even if you’re using parameters:

    db.execute("SELECT ID FROM Tasks WHERE task LIKE ? ESCAPE '@'",
               [ "%! @@ # $ @% ^ & * ( ) '%" ])
    

    Third, the GLOB operator does not have special escape characters;
    you use special characters literally, you have to use them in peculiar ways.
    From the documentation:

    Globbing rules:

    • '*' Matches any sequence of zero or more characters.
    • '?' Matches exactly one character.
    • [...] Matches one character from the enclosed list of characters.
    • [^...] Matches one character not in the enclosed list.

    With the [...] and [^...] matching, a ']' character can be included
    in the list by making it the first character after '[' or '^'. A
    range of characters can be specified using '-'. Example:
    "[a-z]" matches any single lower-case letter. To match a '-', make
    it the last character in the list.

    Hints: to match '*' or '?', put them in "[]". Like this:

    abc[*]xyz Matches "abc*xyz" only

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

Sidebar

Related Questions

I am using MySQL database for my webapp. I need to search over multiple
I need to search for a partial match in an inverted index, following code
I need to search a string in mysql with php. I get an error
I need to search for all users containing a certain text string in their
I need to search for a pattern in files. For example the content of
I need to search for some user input patterns in database. is it efficient
I'm trying to search a field in a database to extract URLs. Sometimes there
I need to escape these characters: +-&|!(){}[]^~*?:\ by preceding them with a \\ .
I am thinking of developing a web search engine using Erlang, Mnesia & Yaws.
I've been using the following code to scrape keywords from Google: $data=file_get_contents('http://clients1.google.com/complete/search?hl=en&gl=us&q='.$keyword); However, my

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.