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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:27:44+00:00 2026-06-09T17:27:44+00:00

I am pretty sure this question is all about regex. I am using the

  • 0

I am pretty sure this question is all about regex.

I am using the JQM router plugin found here. It uses regex to match up pages and bind event handlers. In the docs it states:

A typical mistake is forgetting the $ operator. If you have two pages,
such as #product and #productList, a hypothetical route “#product”
would match both pages, leading to unexpected behaviors

Ok. So I have an #item page and an #items page so I prefixed #item with a $. But now it doesn’t bind the event handler at all. If i dont use the dollar then the binding for item gets applied to both pages. This is the actual implementation:

var router = new $.mobile.Router([
    {"#items": {events:"i", handler: items.controller.init}},
    {"#items(?:[?/](.*))?": {events:"bs", handler: items.controller.onPageBeforeShow}},

    {"#item": {events:"i", handler: item.controller.init}},
    {"#item(?:[?/](.*))?": {events:"bs", handler: item.controller.onPageBeforeShow}},

]);
  • 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-06-09T17:27:45+00:00Added an answer on June 9, 2026 at 5:27 pm

    The $ matches the end of the string in regex. You don’t want to put it at the beginning, you want it at the end.

    For example:

    #product
      matches
    #product
    #productList
    
    #product$
      matches
    #product
    

    Try this code:

    var router = new $.mobile.Router([
        {"#items$": {events:"i", handler: items.controller.init}},
        {"#items(?:[?/](.*))?$": {events:"bs", handler: items.controller.onPageBeforeShow}},
    
        {"#item$": {events:"i", handler: item.controller.init}},
        {"#item(?:[?/](.*))?$": {events:"bs", handler: item.controller.onPageBeforeShow}},
    
    ]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am pretty sure this is a cake 1.3 question - the plugin is not
This, I'm sure is a pretty basic question about JavaScript, so apologies in advance.
All, I'm sure this is a pretty simple SQL query question, but I'm sure
This is probably a really newbie question (well, I'm pretty sure it is), but
Im pretty sure this has a simple solution. I am using jCarousellite, and i
I'm new to Ruby on Rails and I'm sure this question is pretty stupid,
Hey all, this is a follow up to this question: Regex syntax highlighting question
Context: .NET 3.5, VS2008. I'm not sure about the title of this question, so
Pretty sure this has been asked already, but I don't know what to search
I am pretty sure this has been answered before but I cannot seem to

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.