for example I have the following code
Module MPI
Use MPI
!
! MPI info
If (true) Then
Print *, ''
! empty line 1
! empty line 2
End If
Integer ithread, nthread, ierr
End Module MPI
The lines start with ! sign which is comment lines in fortran. I want those comment lines have the same indent as their previous line indent.
That is I want this format
Module MPI
Use MPI
!
! MPI info
If (true) Then
Print *, ''
! empty line 1
! empty line 2
End If
Integer ithread, nthread, ierr
End Module MPI
I want to do this in notepad++ using regex. But if there are better choice feel free to answer.
Here is what I have tried: replace ^(\s*)(.*?\r\n)\s*\! as $1$2$1!. However it produce
Module MPI
Use MPI
!
! MPI info
If (true) Then
Print *, ''
! empty line 1
! empty line 2
End If
Integer ithread, nthread, ierr
End Module MPI
There is still two lines not right. It seems that though the pattern ^(\s*)(.*?\r\n)\s*\! matches this line, however, it just skip it for the regex engine already matched previous lines.
My question is how to solve this indent problem with regex?