Q:

Regex url block specified word AND optimization

The simplified code:
SELECT 'ok' WHERE '/articles/new/' ~ '^/articles/(?!new)([\w-]+)/$';

I/o examples, what i want:
'/articles/new/' => ''
'/articles/new-york/' => 'ok'
'/articles/other-string/' => 'ok'

And, whats wrong:
'/articles/new/' => ''
'/articles/new-york/' => '' /* Wrong */
'/articles/other-string/' => 'ok'

So, have can I block ONLY the word?
OPTIMIZATION
In PostgreSQL database, I have a table (page), and it has got columns path, title, file, regex_path etc.
The datas in path look like this:
/
/articles/
/articles/:category-code/
/articles/:category-code/:article-code/
/articles/:category-code/:article-code/edit/
/articles/new/
/members/
/members/:username/

: mean it's a parameter (PHP get the name and content based on regex_path – the frist version)
From outside (PHP) the database get a value (URL); examples:
/ /* Main page */
/articles/ /* List all article */
/articles/it/ /* List articles in IT category */
/articles/it/ipad-mini-2/  /* Article */
/articles/it/ipad-mini-2/edit/ /* Edit article */
/articles/new/ /* New article */
/members/ /* Member list */
/members/someone/ /* Member datasheet */

How can I select the right row, where the value (URL) 'match' with the path (the fastest way, without regex)?
Example:
In: /articles/it/ipad-mini-2/
Out: the row, where path is: /articles/:category-code/:article-code/ 

A:

This is faster:
SELECT *
FROM   tbl 
WHERE  txt LIKE '/articles/%'
AND    txt <>   '/articles/new/'  -- only exclude this exact string

Or, depending on what you actually need:
...
AND    txt !~~  '/articles/new/%'; -- exclude the whole branch

Since regular expressions are generally more expensive then LIKE or = or <>.
Test with EXPLAIN ANALYZE.
!~~ .. operator for NOT LIKE.
Test
I ran a test to confirm my claim. It's ~ 9x faster than the regular expression.
'^/articles(?!/new/)/([\w-]+)/$'

.. which should be simplified to (a bit faster):
'^/articles/(?!new/)[\w-]+/$'

->SQLfiddle

