Re: [WebDNA] Using Grep to pull links from a variable

This WebDNA talk-list message is from

2014


It keeps the original formatting.
numero = 111369
interpreted = N
texte = --001a11c2c0d4761e8a04f96078b9 Content-Type: text/plain; charset=UTF-8 Here's my attempt: [grep search=http://([^ %0A]*)&replace=\1][convertchars][story][/convertchars][/grep] OK, I'm pretty sure your inner grep does nothing. It finds something and then puts it back in place. In some regex, there's a "blank" designation but I'm not sure WebDNA has that so I'd use space and %0A. Bill On Wed, May 14, 2014 at 1:51 PM, Eddie Z wrote: > I've been using this code for years but have found some issues with it and > don't understand Grep well enough to figure out how to fix it. > > [grep search=http://([^ ]*)&replace=\1][grep > search=http://([^%0A]*)&replace=http://\1 > ][convertchars][story][/convertchars][/grep][/grep] > > Here's an example of the data in the variable [story]: > June 21st > USAV JBT Central Open Qualifier #2 > Bradford Beach, Milwaukee > Register Here - http://tinyurl.com/mjhgzx6/ > Register for Club - http://tinyurl.com/od8bmso/ > > > I understand that the first Grep is searching for the http:// and a > trailing space, but in the example above there is no trailing space because > the link is at the end of the line and followed by a return. I assumed > that's what the second grep was looking for, but this is what the resulting > link is: > tinyurl.com/mjhgzx6 /
Register
> for Club > > The only workaround I've found it to go in and enter a space after the > links. I'm sure it's probably an easy fix to someone that knows how to use > Grep. > > Off topic: Could Grep be used to format phone numbers as 999-999-9999, or > are there too many different ways for people to enter them into a text > field. Common entries would be 9999999999, 999.999.9999, 1-999-999-9999, > (999) 999-9999, et. I realize I could redo my forms to make them enter area > code, prefix and line number separately, but I'm hoping for an easier > method. > > Thanks, > > *Eddie Zelhofer *Thinksite, LLC > 920-420-2066 > http://www.thinksite.com > --------------------------------------------------------- This message is > sent to you because you are subscribed to the mailing list . To > unsubscribe, E-mail to: archives: > http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us --001a11c2c0d4761e8a04f96078b9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Here's my attempt:

[grep search=3Dhttp://([^ %0A]*)&replace=3D<a href=3D"http://\1= ">\1</a>][convertchars][story][/convertchars][/grep]

OK, I'm pretty sure your inner grep does nothing. It f= inds something and then puts it back in place. =C2=A0

In some regex, there's a "blank" designat= ion but I'm not sure WebDNA has that so I'd use space and %0A.=C2= =A0

Bill

On Wed, May 14, 2014 at 1:51 PM, Eddie Z <edd= ie@thinksite.com> wrote:
I've been using this code for years but ha= ve found some issues with it and don't understand Grep well enough to f= igure out how to fix it.

[grep search=3Dhttp://([^ ]*)&replace=3D<a = href=3D"http://\1">\1</a>][grep search=3Dhttp://([^%0A]*= )&replace=3Dhttp://\1 ][convertchars][story][/convertchars][/grep][/gre= p]

Here's an example of the data in the variable= [story]:
June 21st
USAV JBT Central Open Qualifier #2
Brad= ford Beach, Milwaukee
Register Here -=C2=A0http://tinyurl.com/mjhgzx6/
Register for Club -=C2=A0http://tinyurl.com/od8bmso/
=C2=A0
I= understand that the first Grep is searching for the http:// and a trailing= space, but in the example above there is no trailing space because the lin= k is at the end of the line and followed by a return. I assumed that's = what the second grep was looking for, but this is what the resulting link i= s:
<a href=3D"http://tinyurl.com/mjhgzx6/<br>Register">tinyurl.com/mjhgzx6/<br&= gt;Register</a> for Club

The only workaround I've found i= t to go in and enter a space after the links. I'm sure it's probabl= y an easy fix to someone that knows how to use Grep.

Off topic: Could Grep be used to format phone numbe= rs as 999-999-9999, or are there too many different ways for people to ente= r them into a text field. Common entries would be 9999999999, 999.999.9999,= 1-999-999-9999, (999) 999-9999, et. I realize I could redo my forms to mak= e them enter area code, prefix and line number separately, but I'm hopi= ng for an easier method.

Thanks,
Eddie Zelhofer Thinksite, LLC
920-4= 20-2066
http://www.thinksite= .com
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: suppo= rt@webdna.us

--001a11c2c0d4761e8a04f96078b9-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Using Grep to pull links from a variable (Eddie Z 2014)
  2. Re: [WebDNA] Using Grep to pull links from a variable (William DeVaul 2014)
  3. [WebDNA] Using Grep to pull links from a variable (Eddie Z 2014)
--001a11c2c0d4761e8a04f96078b9 Content-Type: text/plain; charset=UTF-8 Here's my attempt: [grep search=http://([^ %0A]*)&replace=\1][convertchars][story][/convertchars][/grep] OK, I'm pretty sure your inner grep does nothing. It finds something and then puts it back in place. In some regex, there's a "blank" designation but I'm not sure WebDNA has that so I'd use space and %0A. Bill On Wed, May 14, 2014 at 1:51 PM, Eddie Z wrote: > I've been using this code for years but have found some issues with it and > don't understand Grep well enough to figure out how to fix it. > > [grep search=http://([^ ]*)&replace=\1][grep > search=http://([^%0A]*)&replace=http://\1 > ][convertchars][story][/convertchars][/grep][/grep] > > Here's an example of the data in the variable [story]: > June 21st > USAV JBT Central Open Qualifier #2 > Bradford Beach, Milwaukee > Register Here - http://tinyurl.com/mjhgzx6/ > Register for Club - http://tinyurl.com/od8bmso/ > > > I understand that the first Grep is searching for the http:// and a > trailing space, but in the example above there is no trailing space because > the link is at the end of the line and followed by a return. I assumed > that's what the second grep was looking for, but this is what the resulting > link is: > tinyurl.com/mjhgzx6 /
Register
> for Club > > The only workaround I've found it to go in and enter a space after the > links. I'm sure it's probably an easy fix to someone that knows how to use > Grep. > > Off topic: Could Grep be used to format phone numbers as 999-999-9999, or > are there too many different ways for people to enter them into a text > field. Common entries would be 9999999999, 999.999.9999, 1-999-999-9999, > (999) 999-9999, et. I realize I could redo my forms to make them enter area > code, prefix and line number separately, but I'm hoping for an easier > method. > > Thanks, > > *Eddie Zelhofer *Thinksite, LLC > 920-420-2066 > http://www.thinksite.com > --------------------------------------------------------- This message is > sent to you because you are subscribed to the mailing list . To > unsubscribe, E-mail to: archives: > http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us --001a11c2c0d4761e8a04f96078b9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Here's my attempt:

[grep search=3Dhttp://([^ %0A]*)&replace=3D<a href=3D"http://\1= ">\1</a>][convertchars][story][/convertchars][/grep]

OK, I'm pretty sure your inner grep does nothing. It f= inds something and then puts it back in place. =C2=A0

In some regex, there's a "blank" designat= ion but I'm not sure WebDNA has that so I'd use space and %0A.=C2= =A0

Bill

On Wed, May 14, 2014 at 1:51 PM, Eddie Z <edd= ie@thinksite.com> wrote:
I've been using this code for years but ha= ve found some issues with it and don't understand Grep well enough to f= igure out how to fix it.

[grep search=3Dhttp://([^ ]*)&replace=3D<a = href=3D"http://\1">\1</a>][grep search=3Dhttp://([^%0A]*= )&replace=3Dhttp://\1 ][convertchars][story][/convertchars][/grep][/gre= p]

Here's an example of the data in the variable= [story]:
June 21st
USAV JBT Central Open Qualifier #2
Brad= ford Beach, Milwaukee
Register Here -=C2=A0http://tinyurl.com/mjhgzx6/
Register for Club -=C2=A0http://tinyurl.com/od8bmso/
=C2=A0
I= understand that the first Grep is searching for the http:// and a trailing= space, but in the example above there is no trailing space because the lin= k is at the end of the line and followed by a return. I assumed that's = what the second grep was looking for, but this is what the resulting link i= s:
<a href=3D"http://tinyurl.com/mjhgzx6/<br>Register">tinyurl.com/mjhgzx6/<br&= gt;Register</a> for Club

The only workaround I've found i= t to go in and enter a space after the links. I'm sure it's probabl= y an easy fix to someone that knows how to use Grep.

Off topic: Could Grep be used to format phone numbe= rs as 999-999-9999, or are there too many different ways for people to ente= r them into a text field. Common entries would be 9999999999, 999.999.9999,= 1-999-999-9999, (999) 999-9999, et. I realize I could redo my forms to mak= e them enter area code, prefix and line number separately, but I'm hopi= ng for an easier method.

Thanks,
Eddie Zelhofer Thinksite, LLC
920-4= 20-2066
http://www.thinksite= .com
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: suppo= rt@webdna.us

--001a11c2c0d4761e8a04f96078b9-- William DeVaul

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

PC Cookie Problem? (2003) Problems with SELECT MULTIPLE (1999) WebMerchant Mac 3.0 beta available (1998) Harvesting invalid email addresses from bounced emails??? (2000) Not really WebCat (1997) Nested vs conditional (1997) Re:2nd WebCatalog2 Feature Request (1996) whole word matching (2004) Dummy Form Variables Needed (2000) WCS Newbie question (1997) SQL Connections (2004) Nested tags count question (1997) PR: WebCatalog Affiliates Program Announced -- Share the (2000) [math] show=F exists? (1997) Problems with date math (1997) OT: Javascript Alert (2004) OT: FTP problems (2003) WebCat/Typhoon Status under Windows (1998) Location of Webcat site in folder hierarchy (1997) Narrowing NT Crashing error (2000)