Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Regular expressions with Javascript

Regular expressions with Javascript

Scheduled Pinned Locked Moved Web Development
helpcsharpjavascriptsysadminregex
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jeslan
    wrote on last edited by
    #1

    I've done a lot of server-side regular expressions (including with .NET), but when it comes to Javascript regular expressions, they don't seem to follow the same rules. I've narrowed down a current issue to be that the Javascript Regular expression evaluator doesn't interpret '\d' to mean a digit, so I made a quick fix by simply inserting in '[0123456789]' instead, which fixed the issue. Am I doing something incredibly dumb, or is the standard for regular expressions in Javascript actually different?

    S 1 Reply Last reply
    0
    • J Jeslan

      I've done a lot of server-side regular expressions (including with .NET), but when it comes to Javascript regular expressions, they don't seem to follow the same rules. I've narrowed down a current issue to be that the Javascript Regular expression evaluator doesn't interpret '\d' to mean a digit, so I made a quick fix by simply inserting in '[0123456789]' instead, which fixed the issue. Am I doing something incredibly dumb, or is the standard for regular expressions in Javascript actually different?

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #2

      There are some differences, although you can force .NET's Regex engine into Javascript compatibility by using the ECMAScript option: ECMAScript vs. Canonical Matching Behavior[^] Here's a tool you might find helpful: http://www.cuneytyilmaz.com/prog/jrx/#[^] If you have questions on the behavior of a specific expression, post the expression along with enough target text to reproduce the behavior you are concerned about.

      ----

      You're right. These facts that you've laid out totally contradict the wild ramblings that I pulled off the back of cornflakes packets.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups