[Phpmyadmin-devel] preg vs. ereg
robbat2 at fermi.orbis-terrarum.net
Sat Aug 18 20:38:57 CEST 2001
Ok, looking under 'Support Requests' (#447076) there is a note about using
ereg instead of preg, so i went back to convert my lone instance of a preg
in the code.
But try as hard as I might, I can't manage to use eregi_replace to do the
same thing as my bit of code.
lib.inc.php3 - line 694
$sql = preg_replace(
Could somebody else make a suggestion about the query I can use?
my best conversion of the pcre was "[!a-zA-Z0-9_]".$data."\." but that
doesn't work :-(.
I have also realized that my code adds a nasty little bug.
this is the SQL i was using to test the above:
SELECT c.id, s.id FROM classes c, staff s WHERE c.staff = s.id ORDER BY
now if i change the fields section at the start just slightly, and the
where clause by taking out some of the white space:
SELECT c.id,s.id FROM classes c, staff s WHERE c.staff=s.id ORDER BY s.id
then the ',' in the fields gets replaced with a space, and your perfectly
valid query is now invalid. The same thing happens with the '=' in the
where clause. We need to find a way to preserve the other character that
matched the \W in the pcre as well as add a space after it. I had the \W
in there so that trying to match 's.' would not match 'foods.' . Any
suggestions on this one?
Robin Hugh Johnson
QTOD: "I used to be an idealist, but I got mugged by reality."
E-Mail : robbat2 at orbis-terrarum.net
ICQ# : 30269588 or 41961639
Home Page : http://www.orbis-terrarum.net/
Time Zone : Pacific Daylight (GMT - 8)
-----BEGIN GEEK CODE-----
GCS/M/IT d-(+) s+:- a--- C++++
U++++ L++++ P--(+) W++ K++ PS+
N++ w--- O E---- M-(+) V-- Y++
PE++ PGP++ t-- 5 X+ R tv- b+++
D++ G++ e(*) h! r-- !y+
------END GEEK CODE------
5447C73A 30FB144C 89521B69 2D6A615E 7E20DFA1
More information about the Developers