stephenjbell

Untitled

Jul 6th, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. ##Collection of useful .replaceAll statements for dotCMS/velocity
  2.  
  3. #### From http://dotcms.com/docs/1.9/VelocityStringReplaceRegex
  4.  
  5. ## REMOVE HTML TAGS
  6. #set($mystring = "<span>test span</span><p> test p</p>")
  7. $mystring.replaceAll("</?[^>]+/?>", "");
  8.  
  9.  
  10. ## REMOVE P TAGS
  11. #set($mystring = "<span>test span</span><p> test p</p>")
  12. $mystring.replaceAll("</?p[^>]*/?>", "");
  13.  
  14.  
  15. #### Mine
  16.  
  17.  
  18. ## I THINK THIS IS BROKEN
  19. ## Replaces the @ and . in email addresses with their HTML special char equivalent to help prevent spam.
  20. ## Can be used in containers for to catch email addresses used in content
  21. #set($Body = $Body.replaceAll("\b([\w\.-]+)@([\w\.-]+)\.(\w{2,4})\b","$1@$2.$3"))
Advertisement
Add Comment
Please, Sign In to add comment