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:

math variable security [MEDIUM LONG] (2000) Limiting user access to .tmpl files (1997) Re:Signal Raised (1997) Pre-flight public flag (1997) Configuration Q (1998) Determining Method (2000) quantity minimum problem (1997) SAVECART (1997) unable to launch acgi in WebCat (1997) WebCat2final1 crashes (1997) ups quickcost [repost] (1999) Mac List Servers (was: Duplicate Hell) (1999) NT vs Mac (1997) Error, 101 a DNS problem ? (1997) Math (1997) Nesting format tags (1997) Re:WebCatalog/WebMerchant III (1998) WebDNA 5.x Deployment? (2003) Email template names (1997) Setting user and password (1999)