Page 1 of 2

Better RegEx Support

Posted: 12 May 2008 09:47
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.

Re: Better RegEx Support

Posted: 12 May 2008 11:54
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.

Re: Better RegEx Support

Posted: 12 May 2008 15:06
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/

Re: Better RegEx Support

Posted: 12 May 2008 20:28
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. :)

Re: Better RegEx Support

Posted: 12 May 2008 20:50
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. :)

Re: Better RegEx Support

Posted: 12 May 2008 20:53
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: )

Re: Better RegEx Support

Posted: 12 May 2008 21:12
by Mesh
admin wrote:
I use VB6. (And I'm proud! :wink: )

Good man!

Re: Better RegEx Support

Posted: 01 Apr 2015 18:23
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

Re: Better RegEx Support

Posted: 02 Apr 2015 00:53
by Papoulka
PCRE will support negative lookbehind, which is essential for finding stuff not preceded by other stuff. It would be nice to have.

Re: Better RegEx Support

Posted: 02 Apr 2015 12:12
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.

Re: Better RegEx Support

Posted: 03 Apr 2015 14:37
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.

Re: Better RegEx Support

Posted: 03 Apr 2015 14:47
by Mesh
I would love moving to PCRE. The Javascript flavor of RegEx is limited in some unfortunate ways.

Re: Better RegEx Support

Posted: 03 Apr 2015 15:10
by SammaySarkar
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. :)

Re: Better RegEx Support

Posted: 03 Apr 2015 15:19
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.

Re: Better RegEx Support

Posted: 21 Apr 2015 16:05
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.