I just had a question about the regex object in javascript…
My regex is this:
data-href="[^"\r\n]*"
when I use it in this site:
http://www.regular-expressions.info/javascriptexample.html
matching against the following string:
<div class="fb-like" data-href="http://example.org" data-send="true" data-layout="box_count"
it tests positive and returns the url. My goal is to dynamically change the value of data-href parameter for the div using javascript to dynamically include the anchors of the webpage (the site Im working on uses an ajax based navigation dependent on # anchors in the url)…. And i really want the facebook button to be mutable so that when a person clicks “like”, they dont just “like” the homepage.
how would I do that?
I tried various tutorials but couldn’t get the regex to match at all (it always returned false).
where should I start?
thx!!!
You can change the attribute using jQuery or any other JS-Framework. Then you don’t need any regex. This
should do it.