Re: simple regex for highlighting _/* fails
Rado S <[email protected]> Sat, 7 Apr 2007 14:27:39 +0200
| Newsgroups | gmane.network.tin.user |
|---|---|
| Message-ID | <[email protected]> |
=- Urs JanÃen wrote on Sat 7.Apr'07 at 0:13:52 +0200 -=
> > (^|[[:space:]'"(])_[^[:space:]_][^_]*[^[:space:]_]_([[:space:]'").,:!?]|$)
> > (^|[[:space:]'"(])_[^[:space:]_][^_]*[^[:space:]_]_[[:space:]'").,:!?]
>
> (empty) capturing subpatterns (yes, this is a bug in the code -
> feel free to fix it). use (?:) instead of (), e.g.
>
> (?:^|[\s'"\(])_[^\s_][^_]*[^\s_]_(?:[\s'"\)\.,:!\?]|$)
Hmm, but why then is this only a problem at the end of the pattern
and not at the beginning, because I'm using the same construct
there (^ instead of $) and it works already when I drop the ()
only at the end?!
> \s is a shorthand for [:space:] and litteral ().? should be
> quoted for clearness
Uh, wait ... wouldn't this make '\' part of the [] range of chars?
Or has tin its own/ extra \-parsing where it removes the \ in
front of '(' inside [] (before it goes to the regex engine)?
Because normally in [] no \ quoting is needed/ possible for
special chars like '('.
I know for \s there is something extra, just wondering whether it
applies to '(', too, so that the result is not changed.
--
© Rado S. -- You must provide YOUR effort for your goal!
EVERY effort counts: at least to show your attitude.
You're responsible for ALL you do: you get what you give.