Re: WG: Problems with regex

Joerg Fischer <[email protected]>
Newsgroups gmane.editors.nedit.user
Message-ID <[email protected]>
> which seems to work. My problem: how can I program a macro to remove the
> first 2 asterisks in a line?

I think the find pattern is ^\s*\*\*, which is to be replaced with an
empty string.

> My first shot
> 
> replace_in_selection("(^[ \\t]*[\*\*] ?)(.*$)", "\\2", "regex")
> 
> doesn't work. I don't have experiences with this function (what does
> "\\2" mean)?

\2 is matched string of the second parentheses, here .*$, which is the
rest of the line after the **. If you don't put the \* inside a
character class (inside the brackets) it will work.

Btw, macros can also be recorded. So, you could use the replace
dialog to type in the pattern (with less escaping) and record
and save the action. It's all pretty well documented in the online
help.

--Jörg
-- 
NEdit Discuss mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.