Re: grep matching

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 47885
interpreted = N
texte = This grep SHOULD work:[grep search=\[([^\-]*)->([^\]]*)\]&replace=\1]but it doesn't under WebDNA 4.5 / OSX... which seems to have a problem putting an end square bracket into a character list.Essentially, the above says find [, then select the next N characters that are not -, then skip over the -> and select the next N characters that are not an end square bracket ].I tried everything I could think of to be able to search for an end square bracket within a character list (delimited by [] in grep), but it will not work. I can search for the character by itself, and I can make it work in a character list in BBEdit, but I can't make it work in WebDNA.SM: Is this a bug?The workaround it to replace the square brackets with something you can search for first, for example, curly braces. This one works for me:[grep search={([^\-]*)->([^}]*)}&replace=\1][grep search=\%5B&replace={][grep search=\%5D&replace=}][SOURCEDATA][/grep][/grep][/grep]- brianOn Wednesday, February 19, 2003, at 06:22 AM, laurent pladys wrote:> hi, > > i am trying to implement the SPIP (www.spip.org) content management > system and word macro in some of my webdna page. basically you do your > page layout and links in word, hit a macro button and all you have to > do is paste the result in a text area to have SPIP transform the > special > meta tags into regular html tags. > For example the following : > > --- > {{{title}}} > go to [some web site->http://www.somewebsite.com] > {cool no} ? > --- > > transforms into > --- >

title

> go to some web site
> cool no ? > --- > > I managed to transform the {{{ with convertwords and a special > database. > > My problem is converting [some web site->http://www.somewebsite.com] > into > some web site > I used : [grep search=\[(.*)->(.*)\]&replace= href=\2>\1][include > spiplike.inc][/grep] > but it looks like that if I have 2 links in the same file the grep > only > happens once and it tries to do the grep on all the links at once. > > Is there a way to tell grep to match the shortest string possible ? > > You can see a sample of the result here : > http://www.lxir.net/demos/spip/ > > Laurent > > > ------------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > > Web Archive of this list is at: http://webdna.smithmicro.com/ > ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re(4): grep matching (laurent pladys 2003)
  2. Re: Re(2): grep matching (Brian Fries 2003)
  3. Re(2): grep matching (laurent pladys 2003)
  4. Re: grep matching (Brian Fries 2003)
  5. Re: grep matching (Rob Marquardt 2003)
  6. Re: grep matching (Brian Fries 2003)
  7. grep matching (laurent pladys 2003)
This grep SHOULD work:[grep search=\[([^\-]*)->([^\]]*)\]&replace=\1]but it doesn't under WebDNA 4.5 / OSX... which seems to have a problem putting an end square bracket into a character list.Essentially, the above says find [, then select the next N characters that are not -, then skip over the -> and select the next N characters that are not an end square bracket ].I tried everything I could think of to be able to search for an end square bracket within a character list (delimited by [] in grep), but it will not work. I can search for the character by itself, and I can make it work in a character list in BBEdit, but I can't make it work in WebDNA.SM: Is this a bug?The workaround it to replace the square brackets with something you can search for first, for example, curly braces. This one works for me:[grep search={([^\-]*)->([^}]*)}&replace=\1][grep search=\%5B&replace={][grep search=\%5D&replace=}][SOURCEDATA][/grep][/grep][/grep]- brianOn Wednesday, February 19, 2003, at 06:22 AM, laurent pladys wrote:> hi, > > i am trying to implement the SPIP (www.spip.org) content management > system and word macro in some of my webdna page. basically you do your > page layout and links in word, hit a macro button and all you have to > do is paste the result in a text area to have SPIP transform the > special > meta tags into regular html tags. > For example the following : > > --- > {{{title}}} > go to [some web site->http://www.somewebsite.com] > {cool no} ? > --- > > transforms into > --- >

title

> go to some web site
> cool no ? > --- > > I managed to transform the {{{ with convertwords and a special > database. > > My problem is converting [some web site->http://www.somewebsite.com] > into > some web site > I used : [grep search=\[(.*)->(.*)\]&replace= href=\2>\1][include > spiplike.inc][/grep] > but it looks like that if I have 2 links in the same file the grep > only > happens once and it tries to do the grep on all the links at once. > > Is there a way to tell grep to match the shortest string possible ? > > You can see a sample of the result here : > http://www.lxir.net/demos/spip/ > > Laurent > > > ------------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > > Web Archive of this list is at: http://webdna.smithmicro.com/ > ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Brian Fries

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:

WebCat2b15MacPlugin - [protect] (1997) #$%@! formulas (1998) New random discoveries? (2005) Multiple prices (1997) [WebDNA] WebDNA 8.6 announced - New features (2018) random in arizona (2003) New Site Announcement (1998) Preventing code execution (2003) Dark Horse Comics success story (1997) Webdna sends your serial number on Internet (2003) WebCatalog for Postcards ? (1997) syntax question, not in online refernce (1997) unitshipcost vs shipcosts (1997) WebCatalog on Linux (2000) sort problems....bug or brain fart? (1997) OH MY GOD! (1998) Multiple Pulldowns (1997) Re[2]: Date Time Oddness (1999) test (2003) searchable list archive (1997)