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:

[WebDNA] WebDNA ImageMagick Functions (2009) [WebDNA] special chars --> WebDNA file upload (2009) [WebDNA] unsubscribe (2008) Ship Cost Not working (2000) Cookie Crumble (1998) Hello? (2004) Auth.net and SIM (2003) [format xs] freeze (1997) automatic reload of frameset (1997) Webstar 1.3.1 PPC (1997) [WC 2.1.30] Stack overflow. (2000) [quantity] within formulas (1997) Intermitent problem using [referrer] (1997) NT 4.0/IIS WebCat Installation (1998) Deleting Orders (1998) Credit Card Number Stripping Digit (1997) Can't Search field (1998) Using Plug-In while running 1.6.1 (1997) WebDNA Writer Needed (1997) Include vs. lookup? (1998)