I tried this in Test.java
String regex = "<\\s*br\\s*/*\\s*>";
String test1 = "< br/ >";
System.out.println(test.replaceAll(regex, " "));`
But when I try the same thing in a velocity template `
#set($brRegex = "<\\s*br\\s*/*\\s*>")
#set($imageDescription = $imageDescription.replaceAll($brRegex, " "))`
And:
#set($imageDescription = $imageDescription.replaceAll("<\\s*br\\s*/*\\s*>", " "))`
Both don't work. Am I missing something?
Omit the extra backslashes. No need to escape them. See Velocity Template - regular expressions
#set($brRegex = "<\s*br\s*/*\s*>")
#set($imageDescription = $imageDescription.replaceAll($brRegex, " "))`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With