Strip block comments: Difference between revisions

Content added Content deleted
(→‎{{header|REXX}}: note about say 66→‎yuppers: 77)
(added autohotkey implementation)
Line 138: Line 138:




function something() {
}</pre>

=={{header|AutoHotkey}}==
<lang AutoHotkey>code =
(
/**
* Some comments
* longer comments here that we can parse.
*
* Rahoo
*/
function subroutine() {
a = /* inline comment */ b + c ;
}
/*/ <-- tricky comments */

/**
* Another comment.
*/
function something() {
}
)
;Open-Close Comment delimiters
openC:="/*"
closeC:="*/"
;Make it "Regex-Safe"
openC:=RegExReplace(openC,"(\*|\^|\?|\\|\+|\.|\!|\{|\}|\[|\]|\$|\|)","\$0")
closeC:=RegExReplace(closeC,"(\*|\^|\?|\\|\+|\.|\!|\{|\}|\[|\]|\$|\|)","\$0")
;Display final result
MsgBox % sCode := RegExReplace(code,"s)(" . openC . ").*?(" . closeC . ")")</lang>
<pre>
function subroutine() {
a = b + c ;
}

function something() {
function something() {
}</pre>
}</pre>