Index
2011-03-25 09:43Matt Slay : Escaping text string for use in Reg Ex???
2011-03-25 16:59Rafael Copquin : Re: Escaping text string for use in Reg Ex???
2011-03-29 11:53Matt Slay : RE: Escaping text string for use in Reg Ex???
2011-03-30 04:24Allen : RE: Escaping text string for use in Reg Ex???
2011-03-30 10:11Matt Slay : RE: Escaping text string for use in Reg Ex???
Back to top
Escaping text string for use in Reg Ex???

Author: Matt Slay

Posted: 2011-03-25 09:43:06   Link

I'm working on a re-write of the VFP app GoFish (search and replace tool).

One thing I am doing with the new version is that internally I'm using

Regular Expressions to perform the search rather than the original way it

worked which was that it just used the $ function to look for a string

match.

So the user will enter a search string which could very likely contain some

characters that are reserved characters in regular expressions. (i.e.

^[]\{}.,;+-$ etc.) I need to escape those characters in the user input so

the reg ex search will work properly.

There are lots of way one could iterate over the input string to escape all

the special characters, and I'm sure there are some trick one must figure

out to do it correctly, so, before I re-invent the wheel here, I'm asking

around to see if anyone already has the code to do this.

Anyone?

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/031d01cbeaf2$93825ad0$ba871070$@com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Matt Slay
Back to top
Re: Escaping text string for use in Reg Ex???

Author: Rafael Copquin

Posted: 2011-03-25 16:59:52   Link

I have been using Gofish for years now and it is much faster than the

Code References utility that comes with VFP.

I don't have any such code but off the top of my head, could you not use

STRTRAN?

ie: cUserInput = strtran(cUserInput,'\','')

Rafael Copquin

El 25/03/2011 10:43, Matt Slay escribió:

> I'm working on a re-write of the VFP app GoFish (search and replace tool).

> One thing I am doing with the new version is that internally I'm using

> Regular Expressions to perform the search rather than the original way it

> worked which was that it just used the $ function to look for a string

> match.

>

> So the user will enter a search string which could very likely contain some

> characters that are reserved characters in regular expressions. (i.e.

> ^[]\{}.,;+-$ etc.) I need to escape those characters in the user input so

> the reg ex search will work properly.

>

> There are lots of way one could iterate over the input string to escape all

> the special characters, and I'm sure there are some trick one must figure

> out to do it correctly, so, before I re-invent the wheel here, I'm asking

> around to see if anyone already has the code to do this.

>

> Anyone?

>

>

>

> --- StripMime Report -- processed MIME parts ---

> multipart/alternative

> text/plain (text body -- kept)

> text/html

> ---

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/4D8D0248.1080901@ciudad.com.ar

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Rafael Copquin
Back to top
RE: Escaping text string for use in Reg Ex???

Author: Matt Slay

Posted: 2011-03-29 11:53:43   Link

Rafael Copquin - That is the basic way I've done it. I was just wondering if

anyone had any other techniques. It works just fine using StrTran().

If you are interested, I will be making beta invites for GoFish Ver 4 pretty

soon. Send me your email address, and I'll keep you posted. You can reach

me at: mattslay (the at symbol) jordanmachine (dot) com

I'm doing some cool things like, coloring the rows of the grid to separate

scx, vcx, prg, frx files. I'm also adding support for search and replace

using regular expressions.

-----Original Message-----

From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces@leafe.com] On

Behalf Of Rafael Copquin

Sent: Friday, March 25, 2011 4:00 PM

To: profoxtech@leafe.com

Subject: Re: Escaping text string for use in Reg Ex???

I have been using Gofish for years now and it is much faster than the

Code References utility that comes with VFP.

I don't have any such code but off the top of my head, could you not use

STRTRAN?

ie: cUserInput = strtran(cUserInput,'\','')

Rafael Copquin

El 25/03/2011 10:43, Matt Slay escribió:

> I'm working on a re-write of the VFP app GoFish (search and replace tool).

> One thing I am doing with the new version is that internally I'm using

> Regular Expressions to perform the search rather than the original way it

> worked which was that it just used the $ function to look for a string

> match.

>

> So the user will enter a search string which could very likely contain

some

> characters that are reserved characters in regular expressions. (i.e.

> ^[]\{}.,;+-$ etc.) I need to escape those characters in the user input so

> the reg ex search will work properly.

>

> There are lots of way one could iterate over the input string to escape

all

> the special characters, and I'm sure there are some trick one must figure

> out to do it correctly, so, before I re-invent the wheel here, I'm asking

> around to see if anyone already has the code to do this.

>

> Anyone?

>

>

>

> --- StripMime Report -- processed MIME parts ---

> multipart/alternative

> text/plain (text body -- kept)

> text/html

> ---

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/052401cbee29$7c2cc610$74865230$@com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Matt Slay
Back to top
RE: Escaping text string for use in Reg Ex???

Author: Allen

Posted: 2011-03-30 04:24:06   Link

Can I put a request in? Exact word please.

Al

-----Original Message-----

From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces@leafe.com] On

Behalf Of Matt Slay

Sent: 25 March 2011 14:43

To: profoxtech@leafe.com

Subject: Escaping text string for use in Reg Ex???

I'm working on a re-write of the VFP app GoFish (search and replace tool).

One thing I am doing with the new version is that internally I'm using

Regular Expressions to perform the search rather than the original way it

worked which was that it just used the $ function to look for a string

match.

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/002301cbeeb3$d68e5580$83ab0080$@com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Allen
Back to top
RE: Escaping text string for use in Reg Ex???

Author: Matt Slay

Posted: 2011-03-30 10:11:29   Link

>> Exact word please.

Already Done!!!

-----Original Message-----

From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces@leafe.com] On

Behalf Of Allen

Sent: Wednesday, March 30, 2011 3:24 AM

To: profoxtech@leafe.com

Subject: RE: Escaping text string for use in Reg Ex???

Can I put a request in? Exact word please.

Al

-----Original Message-----

From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces@leafe.com] On

Behalf Of Matt Slay

Sent: 25 March 2011 14:43

To: profoxtech@leafe.com

Subject: Escaping text string for use in Reg Ex???

I'm working on a re-write of the VFP app GoFish (search and replace tool).

One thing I am doing with the new version is that internally I'm using

Regular Expressions to perform the search rather than the original way it

worked which was that it just used the $ function to look for a string

match.

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/008f01cbeee4$5e37cae0$1aa760a0$@com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Matt Slay