Arn*_*d_t 0 java string replace
如何转换#title到<h1>title</h1>Java中?我正在尝试创建一种算法,将markdown格式转换为html格式.
如果要创建markdown算法,请查找正则表达式.
String noHtml = "#title1";
String html = noHtml.replaceAll("#(.+)", "<h1>$1</h1>");
Run Code Online (Sandbox Code Playgroud)
回答评论 - 更多关于角色类的信息:
String noHtml = "#title1";
String html = noHtml.replaceAll("#([a-zA-Z]+)", "<h1>$1</h1>");
Run Code Online (Sandbox Code Playgroud)