Re: simple regex for highlighting _/* fails
Urs Janßen <[email protected]> Sat, 7 Apr 2007 15:00:53 +0200
| Newsgroups | gmane.network.tin.user |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Apr 07, 2007 at 02:27:39PM +0200, Rado S wrote:
> > > (^|[[: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?!
I didn't check the code, as I said, feel free to fix it.
> > \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?
no
> Or has tin its own/ extra \-parsing where it removes the \ in
> front of '(' inside [] (before it goes to the regex engine)?
tin uses pcre