Tuesday, August 28, 2012

regex – How can I get and replace this in javascript ( jquery?

I need to manipulate a link href which looks like this:



/agents/view/model:Member/ag_start_dateMonth:08/ag_start_dateYear:2012/ag_end_dateMonth:08/ag_end_dateYear:2012



I need to catch the part: ag_start_dateMonth and replace the value 08 with a value the user selected through a form.


That means, that I need to find where in the string is this pattern ag_start_dateMonth and to find the value just after the : and before the next / and to replace it with a new value given by the user through form select option.


How can I do this?

Please advice, I am quite unsure about regex syntax :-/






Rating: 2 out of 5 based on 3 ratings



The post regex – How can I get and replace this in javascript ( jquery? appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/regex-how-can-i-get-and-replace-this-in-javascript-jquery.html

No comments:

Post a Comment