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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:00:41+00:00 2026-05-22T01:00:41+00:00

I have never been any good at regular expressions. I am trying to use

  • 0

I have never been any good at regular expressions. I am trying to use them in building a simple site. I construct a URL just fine like /some-course/some-vtm-1, but when it tries to lookup the defined controller, it fails. Here is the route I have defined:

chapter' => array(
                'type'  => 'Zend_Controller_Router_Route_Regex',
                'route' => '/:course/:vtm\-(\d+)',
                'defaults' => array(
                    'module'     => 'learn',
                    'controller' => 'chapter',
                    'action'     => 'index'
                ),
                'map' => array(
                    1 => 'course',
                    2 => 'vtm',
                    3 => 'id'
                ),
                'reverse' => '%s/%s-%d/'
            ),

How should I correct this Regex so it finds the correct module/controller/action when I a link like /some-course/some-vtm-1 is clicked

  • 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-05-22T01:00:42+00:00Added an answer on May 22, 2026 at 1:00 am

    Your problem is that you’re trying to mix the syntax of Zend_Controller_Router_Route (named variables in the route starting with :) and Zend_Controller_Router_Route_Regex (bracketed regular expression patterns in the route). You want to drop the former and just use the regexp syntax, leaving you with something like this:

    array(
        'type'  => 'Zend_Controller_Router_Route_Regex',
        'route' => '([\w]+)/(vtm)-([\d]+)',
         'defaults' => array(
            'module'     => 'learn',
            'controller' => 'chapter',
            'action'     => 'index'
         ),
         'map' => array(
             1 => 'course',
             2 => 'vtm',
             3 => 'id'
         ),
         'reverse' => '%s/%s-%d'
     ),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've always been intrigued by Map Routing, but I've never found any good introductory
I have never been good at playing with pointers in C. But this time
this is one area of C/C++ that i have never been good at. my
I have been searching for quite a bit now but I have never been
I'm working on a toy game engine. I have never been thinking about coordinate
I have been doing PHP stuff for almost one year and I have never
Lately I have been watching Pluralsight intro videos on MVC 3. I have never
i've been programming for a while, but have never had a formal computer science
Been using XML for ages now for data storage & transfer, but have never
I've been a long time browser here, but never have had a question that

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.