Multiple commands and "if the player's command matches the text"

Here’s what I have now, using some code from this post by matt w:


Include Before Processing a Command by Daniel Stelzer.

[When a player enters a list of commands on the same line, separated by periods or "then," "the player's command" will initially include multiple commands.  I'm using "the current command" to mean only the one currently being run.]

The current command is a text that varies.

Before processing a command (this is the find the current command even if the player has entered a list of commands separated by periods or thens rule):
	if the player's command matches the regular expression "(.+?)(\.|\bthen\b)(.+)":
		now the current command is the text matching subexpression 1;
	otherwise:
		now the current command is the player's command.

Lab is a room.

A frog is here.		

Every turn:
	say "Player's command: [player's command][line break]";
	say "Current command: [current command][line break]";
	if the current command matches the text "frog":
		say "The text 'frog' is found in the current command.";
	otherwise:
		say "The text 'frog' is not found in the current command.";
		
Test me with "x me. x frog. i."

(I haven’t tested this with any of my original rules, e.g. “Does the player mean” rules. I also don’t know if it’s likely to cause other problems, like slowing things down unnecessarily.)

Output:

Lab
You can see a frog here.

>test me
(Testing.)

>[1] x me. x frog. i.
As good-looking as ever.

Player's command: x me. x frog. i.
Current command: x me
The text "frog" is not found in the current command.

You see nothing special about the frog.

Player's command: x frog. i.
Current command: x frog
The text "frog" is found in the current command.

You are carrying nothing.

Player's command: i.
Current command: i.
The text "frog" is not found in the current command.