Closed Thread Icon

Topic awaiting preservation: REGEXP (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12838" title="Pages that link to Topic awaiting preservation: REGEXP (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: REGEXP <span class="small">(Page 1 of 1)</span>\

 
Kriek
Maniac (V) Inmate

From: Florida
Insane since: Jul 2001

posted posted 07-28-2003 15:04

Is there any reason why $privateforum IS also matching 5?
Or perhaps somehow I can be more specific with REGEXP?
The idea is ONLY to block the numbers within $privateforum.

<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>$privateforum = '"<B>([3]

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 07-28-2003 15:21

... and this was *what* to do with regular expressions?


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

Kriek
Maniac (V) Inmate

From: Florida
Insane since: Jul 2001

posted posted 07-28-2003 15:33

Again - The idea is ONLY to block the numbers within $privateforum. (MySQL uses Henry Spencer's implementation of regular expressions, which is aimed at conformance with POSIX 1003.2. MySQL uses the extended version.)

__________________

Kriek says '[SYSTEMWIDE_MESSAGE] PHP Meetup'
What we do is never understood; only praised and blamed

[This message has been edited by Kriek (edited 07-28-2003).]

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 07-28-2003 15:41

Kriek: There isn't need for a regular expression here. I use something similar to this:

quote:
/* add the forum ids you don't want displayed here */
$block_forums = "'69', '666'";

$sql = "SELECT threadid, title, forumid, lastpost, lastposter
FROM thread
WHERE forumid NOT IN ($block_forums)
ORDER BY lastpost DESC
LIMIT 5";



with the vBulletin forum at the GN (to block some forums - in this case the private ones) to get the list here:
http://development.gurusnetwork.com

I would also imagine there is a field that specifies which forums are private (if you just want to block them).

___________________
Emps

FAQs: Emperor

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 07-28-2003 17:27

not to mention that regexps searches kill mysql performance faster than you can say 'argh'.

in (list,of,comma,seperated,values) on a row that has an index is going to be 11000x faster.

Kriek
Maniac (V) Inmate

From: Florida
Insane since: Jul 2001

posted posted 07-28-2003 18:33

Emp, Thank you - I really appreciate it =)

Tyberius, Argh!

__________________

Kriek says '[SYSTEMWIDE_MESSAGE] PHP Meetup'
What we do is never understood; only praised and blamed

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 07-28-2003 18:50

Kriek: No worries. Its a message mr.maX repeats but as with regular expression in general there are often more efficient ways of doing things.

___________________
Emps

FAQs: Emperor

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 07-28-2003 22:14

Hey! some of us love Regular Expressions!


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 07-28-2003 23:22

To answer the question as to why 5 was getting matched as well as 4,6,7,8,9,0 should also get matched is that the square brackets create a character set so:

code:
[24]


creates a set of two charcters that will match 2 & 4

to do this correctly should just be something like

^(2

Kriek
Maniac (V) Inmate

From: Florida
Insane since: Jul 2001

posted posted 07-29-2003 00:51

Bit, that absolutely makes sense - thank you!

__________________

Kriek says '[SYSTEMWIDE_MESSAGE] PHP Meetup'
What we do is never understood; only praised and blamed

« BackwardsOnwards »

Show Forum Drop Down Menu