> match negative multi-byte strings

in perl5, I'd tend to do

     m/(?:(?!union).)*/is

or to capture

     m/((?:(?!union).)*)/is

I suppose you could use union\b instead of union if you wanted allow 
'unions' but disallow 'union'. The general idea is "gobble up each 
character that isn't the start of 'union' (or union\b as you prefer).

In my unpracticed perl6, I *think* that gives you

   noncapturing:
     rx:i/[<!before union>.]*/

   capturing:
     rx:i/([<!before union>.]*)/

....but better perl6ers than I may spot translation issues there. The 
same \b note would apply here (if it's still called \b in perl6 :)

Also, I haven't benchmarked this against the other perl5 solutions 
posted here, so this could be horribly inneficient (in perl5, but maybe 
per6 will like my way better ;)

-matt



Reply via email to