Tyler Frankenstein's Drupal Association Membership Tyler Frankenstein GItHub Link

regex

JavaScript Regular Expressions in Internet Explorer

So today Internet Explorer again decided to be totally awesome...

I have a simple javascript regular expression that extracts the Drupal 'page' variable from a link that was clicked:

<a href="/code?page=1" id="tf_example_link">next page</a>
$('a#tf_example_link').click(function () {
  var page = /[\?&]+page=([0-9]+)[\?&]?/($(this).attr('href'));
  alert(page); // alert output: 1
});

This works in all browsers, except....... drum roll.............. Internet Explorer! Surprised? Probably not.

Subscribe to RSS - regex