1. Daniel Vivier
  2. PowerBuilder
  3. Thursday, 8 December 2022 21:51 PM UTC

I just wanted to share something I created. I have been using the venerable PBREGEXP from https://www.nika-soft.com/download/ for regular expression replacements etc., but yesterday I hit a bad bug in one use of it (I was trying to remove a large section of an HTML file, starting with and ending with , and it crashed my program!).

Although you get source code with it, I really had no interest in trying to understand the code enough to fix that, so I looked for other options.

I found a post suggesting using the COM object VBScript.RegExp, which turns out to work great and have strong features. I wrote an NVO wrapper for it, nvo_regexp.sru, which I am including in my Zip file attachment. The of_test function demonstrates how to use some of it.

I have also included the Windows Scripting Host HTML help file (script56.chm) in the attachment, which I do not know where to find anymore, which has fairly thorough documentation for the RegExp control.

Of course it would be great if PowerScript included stronger RegExp functionality, beyond just Match!

- Dan Cooperstock (sorry, after an ownership change of my business, this account comes up with a different name!)

Attachments (1)
Berka Frenfert Accepted Answer Pending Moderation
  1. Tuesday, 27 December 2022 14:11 PM UTC
  2. PowerBuilder
  3. # 1

First of all Thank you for this nice utility.

I want to search equal sign '='  from a query after SELECT and that equal sign must be before FROM clause in exported syntax of an object. So even 1st occurance is good enough  but between SELECT and FROM.

I am running a loop on every object's syntax in all libraries and need to only log the object name where match is found.

I have run the test  code you gave in of_test() which is working fine but need help with the above case. I dont know what steps are needed in the script. Could you please give some idea? If you help me with the script then that would definately great help.

Many thanks in advance.

True Regards

Berka

 

Comment
  1. Berka Frenfert
  2. Wednesday, 28 December 2022 04:51 AM UTC
Thanks a lot Daniel, That help must be good enough to get results i need. I will try it today.
  1. Helpful
  1. Berka Frenfert
  2. Wednesday, 28 December 2022 10:42 AM UTC
how this can be used in PB. I get no match in PB but you can see online test found 1 match

https://regex101.com/r/d4Sbvp/1

  1. Helpful
  1. Berka Frenfert
  2. Thursday, 29 December 2022 04:45 AM UTC
There was issue with the expression i was testing.
  1. Helpful
There are no comments made yet.
Daniel Vivier Accepted Answer Pending Moderation
  1. Sunday, 11 December 2022 18:49 PM UTC
  2. PowerBuilder
  3. # 2

BTW I did some timing, using the old PBRegExp and the new COM VBScript.RegExp method to validate about 19,000 email addresses we have on file for our customers.

If I called the functions I had written (which instantiated the relevant object each time) the old method took 97 seconds, and new method 4 seconds.

If I only instantiated the objects once then used them for each email address, the old method took 96.8 seconds and the new method took 1/4 second.

So bottom line, not surprising, because PB code execution isn't super fast (perhaps unless you compile to machine code) , and regular expression processing is complex, is that the PowerBuilder PBRegExp code runs far slower than the Microsoft COM control.

This isn't actually important to us, because I'm pretty sure almost all uses in any of our programs are just on one thing at a time, not 19K things, but I certainly found it interesting.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 9 December 2022 06:01 AM UTC
  2. PowerBuilder
  3. # 3

Thank you for sharing this Daniel !

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.