POV-Ray : Newsgroups : povray.off-topic : Mini-languages : Re: Mini-languages Server Time
3 Sep 2024 21:19:02 EDT (-0400)
  Re: Mini-languages  
From: Nicolas Alvarez
Date: 27 Nov 2010 22:58:33
Message: <4cf1d369$1@news.povray.org>
Nicolas Alvarez wrote:
> Invisible wrote:
>> "Syntactically JavaScript resembles Java with some influence from Perl,
>> and features Perl-like regular expressions."
>> 
>> Since when does JS have regular expressions?
> 
> Like in Java, you can create a regular expression object with normal
> object-creation syntax, using the RegExp class:
> 
> var regex = new RegExp("I( have|'ve) never seen ([^.,]*)");
> var text = "I've never seen a system that can do that, but...";
> return "he says he has never seen " + text.match(regex)[2];
> 
> But Javascript also has regex literals built into the language:
> 
> return "he says he has never seen " +
>    text.match(/I( have|'ve) never seen ([^.,]*)/)[2];
> 
> (both return "Invisible has never seen a system that can do that")

Er, of course I mean both return "he says he has never seen a system that 
can do that". I replaced "Invisible" in the input texts and didn't change it 
in the last line.

(I was planning to write a regex to find "is obviously impossible", but then 
couldn't find any good sample text in the p.o-t messages still in the 
server; looks like they really did beat that out of your vocabulary :P)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.