Skip to content
Advertisement

How do I extract code from markdown code block string?

If I have this string like this

JavaScript

or

JavaScript

or

JavaScript

or

JavaScript

How do I get just the console.log() string?

———————————————- Edit ———————————————-

The regex I use is the combination between regex answered by @Himanshu Tanwar with the one suggested by @ASDFGerte

JavaScript

Advertisement

Answer

You can try doing it with regular expression

JavaScript
Advertisement