We are using CK Editor to allow users to create pages for a website.
There is a scenario where there can be build up of the following
<p> </p>
<p> </p>
<p> </p>
I am attempting to use reReplaceNoCase to replace any occurances where this string exists more than 2 times, and replace it with
<p> </p><p> </p>
So that if the string being checked ever has 3 or more instances of <p> </p>
it will replace them with 2. Ensuring there are always no more than 2 <p> </p>
.
I managed to get a RE working for this in Javascript, but am trying to get the same RE working in Lucee, with no luck.
Here is what i currently have:
data.contentBody("
<p>some text</p>
<p> </p>
<p> </p>
<p> </p>
");
data.contentBody = reReplaceNoCase(data.contentBody,'/(<p> <\/p>\s*){2,}/g','<p> </p><p> </p>', 'ALL');
//should result in data.contentBody container "<p>some text</p><p> </p><p> </p>"
But not working. That same RE works fine in Javascript, any suggestions on what i need to do to get this working in Lucee?
Thanks in advance for any pointers!
Jason