Subject Re: manipulating a string
From Charlie <tm@tc.com>
Date Tue, 22 Mar 2022 16:47:12 -0400
Newsgroups dbase.getting-started

Wow Mervyn this is great.  I thought it was going to be a big project and was panning on doing it a different way.  But this works perfectly.

I didn't think of doing the table and images separately which will work great.

I forgot to mention that I only wanted to do this for skus that begin with "LI" at this time.  It was easy to filter the table, but I am not sure how to handle this with the images.  Would it be an addition to the if statement?

Thanks so much!  

Mervyn Bick Wrote:

> On 2022/03/20 23:29, Lee Grant wrote:
> > Mervyn,
> >
> > Thanks for showing me one way to use my new regex skills in dBASE with
> > this example.  I've heard you mention you like using it here, but wasn't
> > sure how you did that. Now I know. :)
>
> I first looked at regular expressions when Michael Nuwer published an
> article in Issue 20 of the dBulletin back in March 2005.
> https://www.jpmartel.com/bulletin.htm
>
> It's a bit of a learning curve but the gain is well worth the pain.
>
> And once one is comfortable with it all sorts of uses come to mind.
> I've used it to add HTML tags, remove HTML tags, find URLs in HTML
> pages, find telephone numbers in HTML pages, add responses to HTML
> pages, highlight words in memo fields, convert UNIX text files to
> Windows text files and vice versa, create a list of all my example code
> that uses externs and a list of code that uses RegExp.
>
> Most of these tasks can be done using the dBASE string handling
> functions.  The RegExp solution is, however, usually significantly less
> code and significantly faster.
>
> To use the dBASE functions usually means reading a source file a line at
> a time, a check to see if action is needed, if so do it, write the line
> back to an output file and then read the next line.  With RegExp one can
> read the entire file into memory, do the test which is virtually
> instantaneous, and then do the replace which is again virtually
> instantaneous. The changed text in memory can then be written out in one
> write.
>
> For a single file the time saving may not be significant but if one has
> to churn through many files it's different story.
>
> Mervyn.