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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:11:15+00:00 2026-06-01T00:11:15+00:00

I am trying to figure out why when I enter a dot (.) into

  • 0

I am trying to figure out why when I enter a dot (.) into my search, it highlights every single character of the search results (it wraps each character in a <span class="search-highlight"></span>) and it’s also only showing 3 tickets which is weird because all of them have at least one dot in them:

screenshot

The query that does the actual searching (along with the variables) is:

$q = mysql_real_escape_string($_GET['q']);
$query = trim(strtoupper($q));
$query = htmlentities($query, ENT_QUOTES, "UTF-8");
$construct = $is_employee==false ? "user='$userid' AND" : "";
$tickets_result = mysql_query("SELECT `id`, `subject`, `message`, `timestamp`, `user` FROM `tickets` WHERE $construct (upper(subject) LIKE '%".$query."%' OR upper(message) LIKE '%".$query."%')") or trigger_error(mysql_error());

And my highlight class:

class highlight
    {
        public $output_text;

        function __construct($text, $words) {
            $split_words = explode(" ", $words);
            foreach ($split_words as $word) {
                $text = preg_replace("|($word)|Ui",
                        "<span class=\"search-highlight\">$1</span>", 
                        $text);
            }
            $this->output_text = $text;
        }
    }

Does anyone know why or how a simple dot (.) would cause this and is it possible to fix?

Thanks for any help in advance.

  • 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-01T00:11:16+00:00Added an answer on June 1, 2026 at 12:11 am

    Just gotta add an alternative to escaped regular expression search here:

    Perhaps what you want is a non-regex replace?

    https://www.php.net/str_replace

    str_replace — Replace all occurrences of the search string with the
    replacement string

    For an exact match, that makes the most sense to me…

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

Sidebar

Related Questions

I'm trying to figure out how to allow a user to enter in a
Im trying to figure out how to let a user enter a website or
I'm trying to figure out the best way to search a number of different
Trying to figure out an equation to get the current group a page would
Trying to figure out the best way to set up collection lists for users
Trying to figure out which to use.
Trying to figure out how to programmatically access the web pages in the application.
Trying to figure out the best way to do this: Should I do something
Trying to figure out how to write a jquery formula that will sum all
Trying to figure out this pseudo code. The following is assumed.... I can only

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.