# ghwikipp: search: Fixed output (bug in regexp, use htmlspecialchars).

**URL:** <https://discourse.libsdl.org/t/ghwikipp-search-fixed-output-bug-in-regexp-use-htmlspecialchars/69390>\
**Category:** SDL Commits\
**Created:** [September 24, 2026, 4:41pm UTC](https://discourse.libsdl.org/t/ghwikipp-search-fixed-output-bug-in-regexp-use-htmlspecialchars/69390 "2026-09-24T16:41:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [September 24, 2026, 4:41pm UTC](https://discourse.libsdl.org/t/ghwikipp-search-fixed-output-bug-in-regexp-use-htmlspecialchars/69390/1 "2026-09-24T16:41:31Z")

</div>

> <https://github.com/libsdl-org/ghwikipp/commit/d55d5f3f2642f6926953956be072afa7788e3e27>
>
> Fixes #68.

```diff
From d55d5f3f2642f6926953956be072afa7788e3e27 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 24 Sep 2026 15:20:21 +0000
Subject: [PATCH] search: Fixed output (bug in regexp, use htmlspecialchars).

Fixes #68.
---
 index.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/index.php b/index.php
index 80b92c6..a31f256 100644
--- a/index.php
+++ b/index.php
@@ -1498,7 +1498,7 @@ function sort_search_results($a, $b)
 
         $pagehits = array();
         foreach ($output as $l) {
- if (preg_match("/^.*\/$raw_data\/(.*)\..*?\:(.*)$/", $l, $matches) != 1) { continue; }
+ if (preg_match("/^.*\/$raw_data\/(.*?)\..*?\:(.*)$/", $l, $matches) != 1) { continue; }
             $p = $matches[1];
             $txt = $matches[2];
 
@@ -1528,7 +1528,7 @@ function sort_search_results($a, $b)
                 $htmllist .= "<li><a href='/$p'>$p</a>:<dl>\n";
                 $first = true;
                 foreach ($txt as $t) {
- $htmltxt = $t; //htmlspecialchars($t, ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED|ENT_HTML5, 'UTF-8');
+ $htmltxt = htmlspecialchars($t, ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED|ENT_HTML5, 'UTF-8');
                     if ($first) {
                         $first = false;
                     } else {

```
