EnlighterJS | :high_brightness: an open source syntax highlighter written in pure javascript | Code Inspection library
kandi X-RAY | EnlighterJS Summary
kandi X-RAY | EnlighterJS Summary
:high_brightness: an open source syntax highlighter written in pure javascript
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Returns an array of tokens from a given source code .
- Parse element .
- Finds all match matches in a code .
- Highlight elements
- Get the special line of the given line numbers .
- Gets the attribute of an element .
- Copy given content to clipboard
- Get raw text from an element
- Map elements to groups .
- Renders the source code in the editor
EnlighterJS Key Features
EnlighterJS Examples and Code Snippets
Community Discussions
Trending Discussions on EnlighterJS
QUESTION
I'm trying to find several custom php variables out of a whole "code block" string to enlighten them via EnlighterJS (v3.3) https://github.com/EnlighterJS/EnlighterJS/commit/a5854c3455b68790aa21d56e2ceb7b734dd72913
In my php code block I'm using a bunch of repeating custom variables which could be considered most likely as global constants like:
$TIME_MS, $GET_URL, $FILE_TYPE
I managed to enlighten the constants without the $ character:
regex: /\b(TIME_MS|GET_URL|FILE_TYPE)\b
But how can I catch the $ character as well? This didn't work:
/\b(\$TIME_MS|\$GET_URL|\$FILE_TYPE)\b
Thanks and best,
Maxxx
...ANSWER
Answered 2020-May-03 at 03:19Word boundaries won't work in front of a $
character, because this is not a word character. \b
finds boundaries between word and non-word characters. Instead, you may use (?:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install EnlighterJS
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page