On 2013-08-09 00:46, rameo wrote:
> I have trouble finding the correct regex.
>
> I know that a sequence of characters enclosed in brackets means
> their optional: [xyz] means any 'x' OR 'y' OR 'z'
>
> but how can I find them all?
> any 'x' AND 'y' AND 'z' in whatever sequence and quantity
Because the syntax "[xyz]" means "'x' at this location or 'y' at this
location or 'z' at this location", using AND would automatically fail
for this context. Only one character can be at a given place in the
text.
If you want them in sequence, then you want "x.*y.*z" which means any
'x' followed eventually by a 'y', followed eventually by a 'z'
If you want to assert that all 3 exist on the same line but in any
order, that's a bit uglier, but made easier by Dr. Chip's logipat.vim
plugin. Using that suggests
\%(.*x.*\&\%(.*y.*\&.*z.*\)\)
where the "\&" atom asserts that each of the pattern parts have to
match.
-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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Friday, August 9, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment