user4072244
user4072244

Reputation:

remove some code from the url pagination

i have the following code, but i am very loose in the regular expression, i am using coldfusion

and i want to remove the code which is inbetween before every next page call

http://beta.mysite.com/?jobpage=2page=2#brands

what i am trying is if jobpage exists, it should remove the jobpage=2 from the URL, {2} is dynamic as it can be one or 2 or 3 and so on.

I tried with listfirst and listlast or gettoken but no help.

Upvotes: 0

Views: 43

Answers (1)

Regular Jo
Regular Jo

Reputation: 5510

This should do it for you

<Cfset myurl = "http://beta.mysite.com/?jobpage=2page=2##brands" />
<cfoutput>#myurl#</cfoutput><br><Br>
<cfset myurl = ReReplaceNoCase(myurl,"(jobpage=[0-9]+[\&]?)","","ALL") />
<cfoutput>#myurl#</cfoutput>

Upvotes: 0

Related Questions