/doc/efun/regexp


SYNOPSIS

string *regexp(string *list, string pattern)

DESCRIPTION

Match the pattern pattern against all strings in list, and return a new array with all strings that matched. This function uses the same syntax for regular expressions as ed()

. Match any character.

^ Match begin of line.

$ Match end of line.

\< Match begin of word.

\> Match end of word.

\B not at edge of a word (supposed to be like the emacs compatibility one in gnu egrep), since 3.2@249

x|y Match regexp x or regexp y.

() Match enclosed regexp like a 'simple' one.

x* Match any number (0 or more) of regexp x.

[..] Match one of the characters enclosed.

[^ ..] Match none of the characters enclosed. The .. are to replaced by single characters or character ranges [abc] matches a, b or c. [ab0-9] matches a, b or any digit. [^a-z] does not match any lowercase character.

\c match character c even if it's one of the special characters.

If there is an error in the regular expression 0 will be returned. Remember that the character "\" has to be escaped with a "\" when written as a LPC string.

EXAMPLE

	string strs;
	if (strs = regexp( ({"please, help me Sir John."}),
				 "\\<help\\>.*\\<me\\>"))
	   if (sizeof(strs)
	      write("It matches.\n");
The regular expression will test the given string (which is packed into an array) if there is something like "help ... me" inside of it.

SEE ALSO

regexplode
regreplace
sscanf

| Home | Applied | Concepts | Efuns | Help | Intro | Lib | LPC | Prop | Obj | Sefuns | Std | W |

Nightfall@quest.tat.physik.uni-tuebingen.de
Automatically generated on Don, 11. Apr 1996