# [Resolved] Regular expression help

Here is some code:

[code]Test is a room.

When play begins:
Let T be indexed text;
Now T is "the swarm of daggers (level 1) in the quartering room (where you currently are)

• the demon of rage (level 2) in the hall of the raging banshees (which lies up from here)";
Let P be indexed text;
let wrongP be indexed text;
Now P is “swarm of daggers <^\n>*where you currently are”;
Now wrongP is “swarm of daggers .*which lies up from here”;
showme whether or not T matches the regular expression P;
showme whether or not T matches the regular expression wrongP;[/code]

What I want is to match when “swarm of daggers” and “where you currently are” are on the same line. I thought P would do that, but it doesn’t match. But just to demonstrate why I can’t use a regular dot instead of the character exclusion class, I have wrongP, which matches something I don’t want to match.

Frustratingly, the manual has this to say about matching (not a newline):

As I have demonstrated, it does make sense to match \N (although I’ve never seen that used in any regular expression language)!

I figured out why this doesn’t work: The expression <^\n> matches any character other than “” and “n”, rather than anything that is not a newline. So how can I actually match (not a newline)?

[code]Test is a room.

When play begins:
Let T be indexed text;
Now T is “the swarm of daggers (level 1) in the quartering room (where you currently are)[line break]- the demon of rage (level 2) in the hall of the raging banshees (which lies up from here)”;
Let P be indexed text;
let wrongP be indexed text;
Now P is “swarm of daggers <^[line break]>*where you currently are”;
Now wrongP is “swarm of daggers <^[line break]>*which lies up from here”;
showme whether or not T matches the regular expression P;
showme whether or not T matches the regular expression wrongP.[/code]

Cool! Thanks.