NAME
regexp - regexp matching function
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.
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."}),
"\\.*\\"))
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
sscanf
Help topics available:
| _find_shortest_path | _fuzzymatch | _get_all_obj | glob | parse_command |
| parse_command.native | process_string | random | regexp | say |
| shout | shutdown | sprintf | write |
You are guest number 114 since January 2020.
This file was last modified: June 2000.