2009/9/7 Kenji <[email protected]>:
>
> Um, that doesn't sound very easy to me. I might just use PCRE
> (pcre.org) instead.

The correct way to do this would be to convert the string to be
searched to an external string and then call a snippet of JS code to
do the actual search.  The interfaces you need are in include/v8.h,
not to be confused with src/v8.h.  Looking in jsregexp.cc is likely to
be a traumatic experience.  There will be a certain amount of overhead
going in and out of JS so performance will be best if there is some
'meat' on the regexp.  If you are just searching for something simple
that is immediately found (like the next space in an English text)
then the overhead will eat up any performance advantages that V8's
regexp implementation has.

>
> Thank Lasse!
>
>
> On 9月7日, 下午1時09分, "Lasse R.H. Nielsen" <[email protected]> wrote:
>> If you already use V8, you can (fairly) easily use the V8 RegExp engine from
>> other code as well. The engine has not been written to be used stand-alone,
>> though. It is tightly bound to the V8 code generation and memory management
>> frameworks, so using it without V8 would require a significant rewrite.
>> You can look at the code in jsregexp.cc to see how the Irregexp compiler is
>> used, and how to call the compiled code.
>>
>> Regards
>> Lasse
>>
>>
>>
>>
>>
>> On Sun, Sep 6, 2009 at 13:01, Kenji <[email protected]> wrote:
>>
>> > Is that possible to use v8's RegEx engine?
>> > or where/how to get a similar RegEx engine somewhere else?
>>
>> > That's because I don't want expressions running in my c++ side are
>> > incompatible to JS side's.
>> > And also a more consistent API.
>>
>> > I guess it makes sense to use v8's because it's already there, right?
>> > Why would I link more code since they are the same thing?
>>
>> > Cheers!
>>
>> > Kenji
>>
>> --
>> Lasse R.H. Nielsen
>>
>> [email protected]
>>
>> 'Faith without judgement merely degrades the spirit divine'
>>
>> Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 København K -
>> Denmark - CVR nr. 28 86 69 84
> >
>



-- 
Erik Corry, Software Engineer
Google Denmark ApS.  CVR nr. 28 86 69 84
c/o Philip & Partners, 7 Vognmagergade, P.O. Box 2227, DK-1018
Copenhagen K, Denmark.

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to