975 |
@end example |
@end example |
976 |
@end defun |
@end defun |
977 |
|
|
978 |
|
@defun looking-back regexp &optional limit |
979 |
|
This function returns @code{t} if @var{regexp} matches text before |
980 |
|
point, ending at point, and @code{nil} otherwise. |
981 |
|
|
982 |
|
Because regular expression matching works only going forward, this is |
983 |
|
implemented by searching backwards from point for a match that ends at |
984 |
|
point. That can be quite slow if it has to search a long distance. |
985 |
|
You can bound the time required by specifying @var{limit}, which says |
986 |
|
not to search before @var{limit}. In this case, the match that is |
987 |
|
found must begin at or after @var{limit}. |
988 |
|
|
989 |
|
@example |
990 |
|
@group |
991 |
|
---------- Buffer: foo ---------- |
992 |
|
I read "@point{}The cat in the hat |
993 |
|
comes back" twice. |
994 |
|
---------- Buffer: foo ---------- |
995 |
|
|
996 |
|
(looking-back "read \"" 3) |
997 |
|
@result{} t |
998 |
|
(looking-back "read \"" 4) |
999 |
|
@result{} nil |
1000 |
|
@end group |
1001 |
|
@end example |
1002 |
|
@end defun |
1003 |
|
|
1004 |
@node POSIX Regexps |
@node POSIX Regexps |
1005 |
@section POSIX Regular Expression Searching |
@section POSIX Regular Expression Searching |
1006 |
|
|