Octavian Rasnita wrote at Sat, 07 Sep 2002 11:03:39 +0200:
> I am trying to match a word boundry or an end of string.
> I would like something like:
>
> /$word[\bX]/
>
> where X is the symbol used for end of string. I know that I can use $ but I
> don't think I can use it between brackets.
>
> I've seen that \b doesn't match the end or beginning of a string.
> I would like to know if there is another symbol that can match both these.
>From perldoc perlre:
\Z Match only at end of string, or before newline at the end
\z Match only at end of string
So you can write
/$word(\b|\Z)/
Please note that you can't use \b in a character class.
>From perldoc perlre:
(Within character classes "\b"
represents backspace rather than a word boundary, just as
it normally does in any double-quoted string.)
Greetings,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]