Code: Select all
echo "foobar" | gawk '{match($0,/^(.)(.+)(.)$/,a);print a[1],a[3]}'
echo "foobar" | gsed 's/^\(.\)\(.\+\)\(.\)$/\1 \3/'
echo "foobar" | ggrep -Poi '[^;]*procedure(?!return)[.]?\w*\s+\K.*\)' || echo "Not Found"
Code: Select all
; Find Comments to translate (";" must be outside strings)
; (\\"|"(?:\\"|[^"])*"|(\+))|;[\s]*(?<pbcomment>.+)
#_PBCOMMENT = ~"(\\\\\"|\"(?:\\\\\"|[^\"])*\"|(\\+))|;[\\s]*(?<pbcomment>.+)"
#_PBCN = 0 : CreateRegularExpression(#_PBCN, #_PBCOMMENT)
pbsource$= ~"line1 \"\\\"AZJ;IO\" ; tet;яis ;я яя \n"+
~"line2 \"я\" ;я\n"+
~"; line3 я\n"+
~"line4 ; pp"
nl = CountString(pbsource$, ~"\n") + 1
For k = 1 To nl
pbsourceline$ = StringField(pbsource$, k, ~"\n") ; ReadString(#File [, Flags [, Length]])
If ExamineRegularExpression(#_PBCN, pbsourceline$)
While NextRegularExpressionMatch(#_PBCN)
pbcm_match$ = RegularExpressionNamedGroup(#_PBCN, "pbcomment") ; <<<=== RTrim?
if pbcm_match$ ; handle strange unicode lookahead "empty match" cases………
Debug "Code Line: '" + pbsourceline$ + "'"
if CountString(pbsourceline$, pbcm_match$) > 1
Debug ~"****** SOMETHING IS WRONG HERE ******\n" ; multiple replacestring
Else
Debug "PureCode: '" + ReplaceString(pbsourceline$, pbcm_match$, "") + "'"
Debug "Comment: '" + pbcm_match$ + ~"'\n"
EndIf
EndIf
Wend
EndIf
Next