Jump to content

Strip block comments: Difference between revisions

added autohotkey implementation
(→‎{{header|REXX}}: note about say 66→‎yuppers: 77)
(added autohotkey implementation)
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() {
}</pre>
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.