Quantcast

W-word Boundaries

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

W-word Boundaries

Shawn H Corey

The two patterns, \< and \> match w-word boundaries. Is there something
to match W-word boundaries? The best I came up with is:

    \(^\|\s\)\@<=

I'm writing a syntax file for G+ comments where in-line styles start
with a W-word boundary, followed by a "*" for bold, "_" for italic, and
"-" for strikeout. \< and \> only works for italic.

Does anyone know a more elegant way?


--
Don't stop where the ink does.

        Shawn H Corey

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: W-word Boundaries

Tim Chase
On 2017-02-13 13:34, Shawn H Corey wrote:

>
> The two patterns, \< and \> match w-word boundaries. Is there
> something to match W-word boundaries? The best I came up with is:
>
>     \(^\|\s\)\@<=
>
> I'm writing a syntax file for G+ comments where in-line styles start
> with a W-word boundary, followed by a "*" for bold, "_" for italic,
> and "-" for strikeout. \< and \> only works for italic.
>
> Does anyone know a more elegant way?

Depending on how your final expression is, \S might do the trick, or
you can use a negative lookbehind assertion:

  \S\@<!

So for your markdown words, it could be something like

  \S\@<!\S\+

-tim


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
BPJ
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: W-word Boundaries

BPJ


Den 13 feb 2017 19:52 skrev "Tim Chase" <[hidden email]>:
On 2017-02-13 13:34, Shawn H Corey wrote:
>
> The two patterns, \< and \> match w-word boundaries. Is there
> something to match W-word boundaries? The best I came up with is:
>
>     \(^\|\s\)\@<=
>
> I'm writing a syntax file for G+ comments where in-line styles start
> with a W-word boundary, followed by a "*" for bold, "_" for italic,
> and "-" for strikeout. \< and \> only works for italic.
>
> Does anyone know a more elegant way?

Depending on how your final expression is, \S might do the trick, or
you can use a negative lookbehind assertion:

  \S\@<!

So for your markdown words, it could be something like

  \S\@<!\S\+

Or to match just the boundary \S\@<!\S\@= on the 'left' side and \S\@<=\S\@! on the 'right' side. This will work at the start/end of line too 

/bpj

(Doing my best to follow style etiquette in Gmail mobile :-)


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...