Got an idea for enhancing SpiderBasic? New command(s) you'd like to see?
bbanelli
 
Posts: 106
Joined: Mon Jul 13, 2015 7:40 am

Regex library with same functions as in PB

by bbanelli Thu Jan 04, 2018 11:21 pm

Greetings to all,

quite simple - having functions like ExamineRegularExpression(), NextRegularExpressionMatch(), RegularExpressionGroup(), RegularExpressionMatchString() and others missing in SB?

I am no expert but this implementation of regex in SB makes is quite inferior to one in PB, not to mention code cannot be recycled; at least that should be rather straight forward with regex manipulation.

With my best,

Bruno
"If you lie to the compiler, it will get its revenge."
Henry Spencer
http://www.pci-z.com/
User avatar
Tristano
 
Posts: 2
Joined: Fri Jun 19, 2020 12:24 am
Location: Italy

Re: Regex library with same functions as in PB

by Tristano Tue Jun 30, 2020 1:36 pm

bbanelli wrote:not to mention code cannot be recycled; at least that should be rather straight forward with regex manipulation.


Even if SB native commands for RegEx were identical to those available in PB, you might still be unable to recycle code (i.e. make it cross-architecture — PB x86 & web) unless SB is using PCRE. See my question:

viewtopic.php?f=6&t=1943
https://www.regular-expressions.info/javascript.html

If SB is leveraging JavaScript's native RegExs, then the supported notations and features will largely depend on which browser is running the SB app:

viewtopic.php?f=6&t=1943

In Chrome, you'd be able to enjoy the latest features from ECMA 2018, but if you're targeting a Win app that relies on the WebBrowser control (IE7-11), or a CHM Help document (IE7), then you're stuck with a pretty poor RegEx subset.

For a comparison of the differences between JS and PCRE RegEx, see:

https://web.archive.org/web/20130830063 ... avors.html

There are 3rd party alternative libraries, like XRegExp, which are much better but still not 100% PCRE compliant:

http://xregexp.com/

So, unless SB where to adopt the original PCRE library used by PB (i.e. cross compiling it via tools like Emscripten) portability of RegExs definitions between PB and SB is going to be an issue.

I was quite surprised to discover that none of the above considerations are being mentioned in SB Help docs, for they seem rather important aspects of working with RegExs (a developer needs to know exactly which RegEx flavour is working with, so that he/she can consult the correct documentation and be able to predict browser-dependent differences).
Return to Feature Requests and Wishlists

Who is online

Users browsing this forum: No registered users and 2 guests