Link to home
Start Free TrialLog in
Avatar of jrhabana
jrhabana

asked on

regex replace up to char or end of line

Hello,  i had this strings

http://domain.com/?param1=value1¶m2=value2
http://domain.com/?param1=value1¶m2=value2¶m3=value3

I want replace, param2=xxxx with param2=bbbb
but i'm having problems to detect the end to group to replace, due can be & or end of line
I tryed this mystring.replace(/&param2=(.*)(?=&|$)/gi,'&param2=newvalue' ) but don't work
Thanks
SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial