WG: Problems with regex

David, Patrick (I/EG-711) patrick.david at audi.de
Tue Mar 3 16:55:05 CET 2009


Hello out there,

I want to extend my macro library to make nedit able to deal with *.inp
Files (this extension is used by the commercial Finite-Element-Method
software Abaqus).
First I want to teach nedit how to deal with comments in these files. A
commented line starts with two asterisks (**). My macro line for
automatic commenting is the following:

replace_in_selection("^.*$", "** $", "regex")

which seems to work. My problem: how can I program a macro to remove the
first 2 asterisks in a line?
My first shot

replace_in_selection("(^[ \\t]*[\*\*] ?)(.*$)", "\\2", "regex")

doesn't work. I don't have experiences with this function (what does
"\\2" mean)?

In addition it's probably important to know that keywords in Abaqus
starts with a single asterisk. Example:

Original:
----------------------
*STEP, NAME=myStep
My Step Description
*STATIC
*LOAD
1, 1
*END STEP

Commented:
-------------------------
***STEP, NAME=myStep
**My Step Description
***STATIC
***LOAD
**1, 1
***END STEP

Has anyone of you an idea for the uncommenting macro function?
Hope for help
Patrick



More information about the Discuss mailing list