#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(\/)(\*)(.|\n)*?\2\1|(\/\/.*)"
Local $sString = "#include<stdio.h>" & @CRLF & _
"#include<stdlib.h>" & @CRLF & _
"typedef struct Node" & @CRLF & _
"{" & @CRLF & _
" int data;" & @CRLF & _
" struct Node *next;" & @CRLF & _
" struct Node *prev;" & @CRLF & _
"}node;" & @CRLF & _
"void insert(node *pointer, int data)" & @CRLF & _
"{" & @CRLF & _
" /* Iterate through the list till we encounter the last node.*/" & @CRLF & _
" while(pointer->next!=NULL)" & @CRLF & _
" {" & @CRLF & _
" pointer = pointer -> next;" & @CRLF & _
" }" & @CRLF & _
" /* Allocate memory for the new node and put data in it.*/" & @CRLF & _
" pointer->next = (node *)malloc(sizeof(node));" & @CRLF & _
" (pointer->next)->prev = pointer;" & @CRLF & _
" pointer = pointer->next;" & @CRLF & _
" pointer->data = data;" & @CRLF & _
" pointer->next = NULL;" & @CRLF & _
"}" & @CRLF & _
"int find(node *pointer, int key)" & @CRLF & _
"{" & @CRLF & _
" pointer = pointer -> next; //First node is dummy node." & @CRLF & _
" /* Iterate through the entire linked list and search for the key. */" & @CRLF & _
" while(pointer!=NULL)" & @CRLF & _
" {" & @CRLF & _
" if(pointer->data == key) //key is found." & @CRLF & _
" {" & @CRLF & _
" return 1;" & @CRLF & _
" }" & @CRLF & _
" pointer = pointer -> next;//Search in the next node." & @CRLF & _
" }" & @CRLF & _
" /*Key is not found */" & @CRLF & _
" return 0;" & @CRLF & _
"}" & @CRLF & _
"void delete(node *pointer, int data)" & @CRLF & _
"{" & @CRLF & _
" /* Go to the node for which the node next to it has to be deleted */" & @CRLF & _
" while(pointer->next!=NULL && (pointer->next)->data != data)" & @CRLF & _
" {" & @CRLF & _
" pointer = pointer -> next;" & @CRLF & _
" }" & @CRLF & _
" if(pointer->next==NULL)" & @CRLF & _
" {" & @CRLF & _
" printf("Element %d is not present in the list\n",data);" & @CRLF & _
" return;" & @CRLF & _
" }" & @CRLF & _
" /* Now pointer points to a node and the node next to it has to be removed */" & @CRLF & _
" node *temp;" & @CRLF & _
" temp = pointer -> next;" & @CRLF & _
" /*temp points to the node which has to be removed*/" & @CRLF & _
" pointer->next = temp->next;" & @CRLF & _
" temp->prev = pointer;" & @CRLF & _
" /*We removed the node which is next to the pointer (which is also temp) */" & @CRLF & _
" free(temp);" & @CRLF & _
" /* Beacuse we deleted the node, we no longer require the memory used for it ." & @CRLF & _
" free() will deallocate the memory." & @CRLF & _
" */" & @CRLF & _
" return;" & @CRLF & _
"}" & @CRLF & _
"void print(node *pointer)" & @CRLF & _
"{" & @CRLF & _
" if(pointer==NULL)" & @CRLF & _
" {" & @CRLF & _
" return;" & @CRLF & _
" }" & @CRLF & _
" printf("%d ",pointer->data);" & @CRLF & _
" print(pointer->next);" & @CRLF & _
"}" & @CRLF & _
"int main()" & @CRLF & _
"{" & @CRLF & _
" /* start always points to the first node of the linked list." & @CRLF & _
" temp is used to point to the last node of the linked list.*/" & @CRLF & _
" node *start,*temp;" & @CRLF & _
" start = (node *)malloc(sizeof(node));" & @CRLF & _
" temp = start;" & @CRLF & _
" temp -> next = NULL;" & @CRLF & _
" temp -> prev = NULL;" & @CRLF & _
" /* Here in this code, we take the first node as a dummy node." & @CRLF & _
" The first node does not contain data, but it used because to avoid handling special cases" & @CRLF & _
" in insert and delete functions." & @CRLF & _
" */" & @CRLF & _
" printf("1. Insert\n");" & @CRLF & _
" printf("2. Delete\n");" & @CRLF & _
" printf("3. Print\n");" & @CRLF & _
" printf("4. Find\n");" & @CRLF & _
" while(1)" & @CRLF & _
" {" & @CRLF & _
" int query;" & @CRLF & _
" scanf("%d",&query);" & @CRLF & _
" if(query==1)" & @CRLF & _
" {" & @CRLF & _
" int data;" & @CRLF & _
" scanf("%d",&data);" & @CRLF & _
" insert(start,data);" & @CRLF & _
" }" & @CRLF & _
" else if(query==2)" & @CRLF & _
" {" & @CRLF & _
" int data;" & @CRLF & _
" scanf("%d",&data);" & @CRLF & _
" delete(start,data);" & @CRLF & _
" }" & @CRLF & _
" else if(query==3)" & @CRLF & _
" {" & @CRLF & _
" printf("The list is ");" & @CRLF & _
" print(start->next);" & @CRLF & _
" printf("\n");" & @CRLF & _
" }" & @CRLF & _
" else if(query==4)" & @CRLF & _
" {" & @CRLF & _
" int data;" & @CRLF & _
" scanf("%d",&data);" & @CRLF & _
" int status = find(start,data);" & @CRLF & _
" if(status)" & @CRLF & _
" {" & @CRLF & _
" printf("Element Found\n");" & @CRLF & _
" }" & @CRLF & _
" else" & @CRLF & _
" {" & @CRLF & _
" printf("Element Not Found\n");" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"}"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm