views:

256

answers:

2

EDIT: It was some issue with Notepad++'s regex engine. The regex worked fine in Python.

I'm working in Notepad++. I tried to make a regexp that would transform this (if you're curious, it's a Spanish guide for a game):

*Acero: En la Estatua de Gabomba
**Absorbe PV de un enemigo

To this:

====Acero====
*En la Estatua de Gabomba
*Absorbe PV de un enemigo

I came up with this, but it doesn't match the text:

\*([^:]+): ([\w ]+)\n\*\*([^\n]+)

Am I missing something obvious?

+2  A: 

It seems that Notepad++ cannot find line breaks in regex mode. You'll have to replace the line breaks with, say, |, in extended mode, apply the regex on your new string, then replace the |s with line breaks.

Eric
+1  A: 

Your regex is correct. Try to search for \*([^:]+): ([\w ]+) and \*\*([^\n]+) separately and it will match.

It is just that Notepad++ does not support multiline regular expressions (because Scintilla doesn't). Note that there are two different search dialogs available: Ctrl+F shows the builtin dialog, Ctrl+R shows TextFX's dialog which has more options. But TextFX doesn't support multiline search either.

AndiDog