I need a REGEX pattern that will transform a raw HTML block in the following way:
<!DOCTYPE html>
...
<anytag>
<h1>This is the less than < symbol. </h1>
<h1>This is the less than or equal to <= symbol. </h1>
</anytag>
Transforms to:
<!DOCTYPE html>
...
<anytag>
<h1>This is the less than < symbol. </h1>
<h1>This is the less than or equal to <= symbol. </h1>
</anytag>
So that the < character in only HTML tags is replaced, and nowhere else.
This is to solve an issue with syntax highlighting of html with prism.js here:
highlighting html with prism.js
Thanks Washington Guedes
答案 0 :(得分:2)
答案 1 :(得分:-2)
Here are some common entities. You do not need to use the full code - there are common aliases for frequently used entities. For example, you can use < and > to indicate less than and greater than symbols. & is ampersand, etc.
EDIT: That should be - < > and &