[WebDNA] Using Grep to pull links from a variable
This WebDNA talk-list message is from 2014
It keeps the original formatting.
numero = 111368
interpreted = N
texte = > This message is in MIME format. Since your mail reader does not understandthis format, some or all of this message may not be legible.--B_3482916702_90192016Content-type: text/plain;charset="US-ASCII"Content-transfer-encoding: 7bitI've been using this code for years but have found some issues with it anddon't understand Grep well enough to figure out how to fix it.[grep search=http://([^ ]*)&replace=
\1][grepsearch=http://([^%0A]*)&replace=http://\1][convertchars][story][/convertchars][/grep][/grep]Here's an example of the data in the variable [story]:June 21stUSAV JBT Central Open Qualifier #2Bradford Beach, MilwaukeeRegister 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 trailingspace, but in the example above there is no trailing space because the linkis at the end of the line and followed by a return. I assumed that's whatthe second grep was looking for, but this is what the resulting link is:
tinyurl.com/mjhgzx6 /
Register for ClubThe only workaround I've found it to go in and enter a space after thelinks. I'm sure it's probably an easy fix to someone that knows how to useGrep.Off topic: Could Grep be used to format phone numbers as 999-999-9999, orare there too many different ways for people to enter them into a textfield. 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 areacode, prefix and line number separately, but I'm hoping for an easiermethod.Thanks,Eddie ZelhoferThinksite, LLC920-420-2066http://www.thinksite.com--B_3482916702_90192016Content-type: text/html;charset="US-ASCII"Content-transfer-encoding: quoted-printable
I've been using this code for years b=ut have 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][/gre=p][/grep]
Here's an example of the data in th=e variable [story]:
Register for Club =-
http://tinyurl.com/od8bmso/<=/div>
<=div>
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:
<a href=3D"http://tinyu=rl.com/mjhgzx6/
<br>Register">tinyurl.com/mjhgzx6/
<br>Re=gister</a> 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 ar=e 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, pref=ix and line number separately, but I'm hoping for an easier method.=div>
Thanks,
--B_3482916702_90192016--
Associated Messages, from the most recent to the oldest:
> This message is in MIME format. Since your mail reader does not understandthis format, some or all of this message may not be legible.--B_3482916702_90192016Content-type: text/plain;charset="US-ASCII"Content-transfer-encoding: 7bitI've been using this code for years but have found some issues with it anddon't understand Grep well enough to figure out how to fix it.[grep search=http://([^ ]*)&replace=
\1][grepsearch=http://([^%0A]*)&replace=http://\1]
[convertchars][story][/convertchars][/grep][/grep]Here's an example of the data in the variable [story]:June 21stUSAV JBT Central Open Qualifier #2Bradford Beach, MilwaukeeRegister 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 trailingspace, but in the example above there is no trailing space because the linkis at the end of the line and followed by a return. I assumed that's whatthe second grep was looking for, but this is what the resulting link is:
tinyurl.com/mjhgzx6 /
Register for ClubThe only workaround I've found it to go in and enter a space after thelinks. I'm sure it's probably an easy fix to someone that knows how to useGrep.Off topic: Could Grep be used to format phone numbers as 999-999-9999, orare there too many different ways for people to enter them into a textfield. 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 areacode, prefix and line number separately, but I'm hoping for an easiermethod.Thanks,Eddie ZelhoferThinksite, LLC920-420-2066http://www.thinksite.com--B_3482916702_90192016Content-type: text/html;charset="US-ASCII"Content-transfer-encoding: quoted-printable
I've been using this code for years b=ut have 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][/gre=p][/grep]
Here's an example of the data in th=e variable [story]:
Register for Club =-
http://tinyurl.com/od8bmso/<=/div>
<=div>
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:
<a href=3D"http://tinyu=rl.com/mjhgzx6/
<br>Register">tinyurl.com/mjhgzx6/
<br>Re=gister</a> 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 ar=e 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, pref=ix and line number separately, but I'm hoping for an easier method.=div>
Thanks,
--B_3482916702_90192016--
Eddie Z
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:
RE: Webcat 2.0.1b1 bug with IE 3.01/4.0p1 (1997)
Date search - yes or no (1997)
truncating email part II (1997)
WebCatalog for guestbook ? (1997)
Frames and WebCat (1997)
error in online 3.x docs - makes it impossible to read aboutfile formats (2000)
Math with Time (1997)
Wow .. (2003)
ADMIN ACCESS (1999)
Limitations of spawn? (2006)
Navigator 4.01 (1997)
Solve the Problem, get the code! (2001)
WebMerchant 1.6 and SHTML (1997)
Strange intermittent WebDNA problems (2008)
popups, netscape vs explorer (1997)
Emailer Timing out (1999)
More on the email templates (1997)
WebCat2 - Getting to the browser's username/password data (1997)
Rendering out a page (1997)
Searching Numbers (2004)