Jump to content

regexp frustrations


subtledoctor

Recommended Posts

So regexp is not a skill I ever picked up, and some of it looks totally opaque to me. I'm trying to use REPLACE_TEXTUALLY to convert something like this:

Aid
(Necromancy, Conjuration)

Level: 2
Sphere: Necromantic
Range: Touch
to this:

Aid
(Necromancy, Conjuration)

Level: 2
Sphere: %variable%
Range: Touch
... for every priest spell. Basically replace anything on the 'Sphere' line after the colon, to the end of the line (including multiple words if necessary), with a variable I've already set. My usual method of figuring this stuff out (spend four hours on my laptop ignoring my wife, banging my head against a wall until the particular arcane formulation becomes evident, almost-but-not-quite the same as the 10,000 other formulations I tried) is not possible right now.

 

So, little help?

Link to comment

A substitution (using perl syntax) would be

 

s/^Sphere:.*$/Sphere:$myVar/

 

A line that matches ^Sphere:.*$ will be replaced by Sphere:<content of myVar>

 

The nice (?) thing of regexps is that there are so many different kinds of them. But dead useful.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...