Jump to content

Changing particular text within the data.


Recommended Posts

So all of the data changes per record for their unique URL or "PURL" for this campaign.


Customer would like to do the following:


Change this:



to this:



My attempt to make this happen:


return Field("Personalized URLs").replace(/[\Myprepassbenefits\>\/]/g,"MyPrePassBenefits");


Basically, initial cap-case conversion for just part the Myprepassbenefits portion of the data.

Link to comment
Share on other sites

You don't want to put "Myprepassbenefits" between brackets ([]). Brackets start a character class and finds a match for each character in that class. Basically, you'll replace each of those letters with "MyPrePassBenefits." Secondly, I don't think you'll need to capture >'s or /'s. You can rewrite it like this:


return Field("Personalized URLs").replace(/Myprepassbenefits/gi,"MyPrePassBenefits");


Notice that I put an 'i' at the end of the regex so that the match is not case-sensitive. That means this will match "myprepassbenefits" and format it correctly.


Hope that helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...