Better RegEx Support

Features wanted...
Mesh
Posts: 956
Joined: 24 Mar 2008 21:22

Better RegEx Support

Post by Mesh »

I love that XY supports RegEx. However, it does so through VBScript, which is somewhat limited. It would be nice if XY supported a more robust flavor, such as Perl RegEx.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Better RegEx Support

Post by admin »

I'm not aware of a way to do this.

For RegEx XY uses this file C:\WINDOWS\system32\vbscript.dll, which can be expected to be present in virtually every Windows system nowadays.

Mesh
Posts: 956
Joined: 24 Mar 2008 21:22

Re: Better RegEx Support

Post by Mesh »

admin wrote:
I'm not aware of a way to do this.

For RegEx XY uses this file C:\WINDOWS\system32\vbscript.dll, which can be expected to be present in virtually every Windows system nowadays.

Well, I don't know what language you program XY in - I'm assuming it's not Perl. :)

In that case, however, one good possibility is to use PCRE (Perl Compatible Regular Expressions), which is an open source library written in C (although many people have made libraries from PCRE to make it compatible with other programming languages). That makes it easy and free to implement, in most cases.


There's more information about it here, if you're interested:

http://www.regular-expressions.info/pcre.html
http://en.wikipedia.org/wiki/PCRE
http://www.pcre.org/

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Better RegEx Support

Post by admin »

Mesh wrote:
admin wrote:
I'm not aware of a way to do this.

For RegEx XY uses this file C:\WINDOWS\system32\vbscript.dll, which can be expected to be present in virtually every Windows system nowadays.

Well, I don't know what language you program XY in - I'm assuming it's not Perl. :)

In that case, however, one good possibility is to use PCRE (Perl Compatible Regular Expressions), which is an open source library written in C (although many people have made libraries from PCRE to make it compatible with other programming languages). That makes it easy and free to implement, in most cases.


There's more information about it here, if you're interested:

http://www.regular-expressions.info/pcre.html
http://en.wikipedia.org/wiki/PCRE
http://www.pcre.org/
The language is VB. Even if PCRE would work with VB (which I never heard of), I wouldn't use it because I would not like to ship a 3rd party component. So thanks, but no. :)

Mesh
Posts: 956
Joined: 24 Mar 2008 21:22

Re: Better RegEx Support

Post by Mesh »

admin wrote:
The language is VB. Even if PCRE would work with VB (which I never heard of), I wouldn't use it because I would not like to ship a 3rd party component. So thanks, but no. :)

I understand (although vbscript.dll is technically a 3rd party component as well). :)

Although I personally despise managed languages, if you're using VB.net instead of VB anyway, you'd also have access to the .NET RegEx libraries. (But if you're not using the .NET version, please don't switch!)


In any case, I'll just put this out there as an idle wish. :)

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Better RegEx Support

Post by admin »

Mesh wrote:
admin wrote:
The language is VB. Even if PCRE would work with VB (which I never heard of), I wouldn't use it because I would not like to ship a 3rd party component. So thanks, but no. :)

I understand (although vbscript.dll is technically a 3rd party component as well). :)

Although I personally despise managed languages, if you're using VB.net instead of VB anyway, you'd also have access to the .NET RegEx libraries. (But if you're not using the .NET version, please don't switch!)


In any case, I'll just put this out there as an idle wish. :)
I use VB6. (And I'm proud! :wink: )

Mesh
Posts: 956
Joined: 24 Mar 2008 21:22

Re: Better RegEx Support

Post by Mesh »

admin wrote:
I use VB6. (And I'm proud! :wink: )

Good man!

jackpots
Posts: 11
Joined: 23 Oct 2012 17:14

Re: Better RegEx Support

Post by jackpots »

I think it is time to re-evaluate the sentiment to move to a more feature-rich implementation of Regular Expression, and PCRE2 is probably the best way to go. VB uses the JavaScript implementation in Internet Explorer 5.5, and that's at the turn of the century (1999/2000). Time to move on. Right?

Since PCRE is more robust, it could replace all the current items in the Replace menu, except for the incrementing number. More importantly, it would afford the users much greater abilities in searching, and in string replacements. The current Regex is decent but limited. For example, one cannot manage the case of a replaced capture.

In addition, PCRE is open and BSD licensed.

PCRE= Perl Compatible Regular Expression

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: Better RegEx Support

Post by Papoulka »

PCRE will support negative lookbehind, which is essential for finding stuff not preceded by other stuff. It would be nice to have.

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: Better RegEx Support

Post by Marco »

+1

I even thought about writing some XY scripts to offload regex matching to external utilities like http://www.rexegg.com/pcregrep-pcretest.html or https://sites.google.com/site/regexreplace/ , but I have no time and I'm not a fan of using temp files for these kind of things.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

aliteralmind
Posts: 261
Joined: 02 Dec 2014 16:49

Re: Better RegEx Support

Post by aliteralmind »

+1 as well.

Don't know if this is compatible, but TextPad uses the Boost regex engine, which has some lookbehind issues, but is otherwise an excellent PCRE-like engine.
Windows 8.1, 64-bit

Mesh
Posts: 956
Joined: 24 Mar 2008 21:22

Re: Better RegEx Support

Post by Mesh »

I would love moving to PCRE. The Javascript flavor of RegEx is limited in some unfortunate ways.

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Better RegEx Support

Post by bdeshi »

admin wrote:Even if PCRE would work with VB (which I never heard of), I wouldn't use it because I would not like to ship a 3rd party component. So thanks, but no. :)
Could provide an option in config: Regular Expression handlers, like custom copy handlers. :)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Mesh
Posts: 956
Joined: 24 Mar 2008 21:22

Re: Better RegEx Support

Post by Mesh »

SammaySarkar wrote:
Could provide an option in config: Regular Expression handlers, like custom copy handlers. :)

Oooo, that sounds lovely. If that's done, there should be a link on the site for a trusted package that works with this feature out of the box.

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: Better RegEx Support

Post by Marco »

SammaySarkar wrote:Could provide an option in config: Regular Expression handlers, like custom copy handlers. :)
I love this idea. If it proves to be possible and doable, then we could write a petition to the "Regex Guy" (Jan Goyvaerts - http://www.just-great-software.com/ ) and ask him to write an external regex module hookable into XY. I'd gladly pay for that.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Post Reply