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 :-/
If this input come from a form on the page, you can always “Rebuild” the href instead of search and replace. Say you have a form you were getting these values from on the page, with jQuery this would be trivial with something like