retirer balise html en Lotus Script
bonjour
je cherche un code Lotus Script pour retirer le balisage html d'une chaine de caractere
je cherche un code Lotus Script pour retirer le balisage html d'une chaine de caractere
Forums Lotus Domino/Notes en Français
http://forum.dominoarea.org/
Michael DELIQUE a écrit:re,
je l'ai en JS mais sans framework j'aimerais éviter d'avoir a implémenter les expression réguliere en LS
import java.util.regex.*;
public class LSRegEx {
public static String stripTags (String s) {
Pattern p = Pattern.compile("<\\w+(\\s+("[^"]*"|'[^']*'|[^>])+)?>|</w>");
Matcher m = p.matcher(s);
return m.replaceAll("");
}
public static String stripScripts (String s) {
Pattern p = Pattern.compile("<script>]*>([\\S\\s]*?)</script>");
Matcher m = p.matcher(s);
return m.replaceAll("");
}
} Dim jSession As JavaSession
Dim lSRegEx As JavaClass
Set jSession = New JavaSession()
Set lSRegEx = jSession.GetClass("LSRegEx")
Const codeHtml = |a <a>link</a><script>alert("hello world!");</script>|
Print lSRegEx.stripTags(codeHtml )
Print lSRegEx.stripScripts(codeHtml )
Print lSRegEx.stripTags(lSRegEx.stripScripts(codeHtml ) )