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:

Forcing Paragraph Breaks on Results (1998) WebCat2b13MacPlugIn - [shownext method=post] ??? (1997) emailer (1997) Comments in db? (1997) Running _every_ page through WebCat-error.html (1997) RequiredFields template (1997) url .. (2003) Weird error/limit - something amiss? (1997) Beta 18 (1997) problems with WebCat-Plugin (1997) macosx 1 process, linux N processes, macosx chokes under load (2001) best way to test for the existence of a parameter in a url (2003) RAM variables (1997) [WebDNA] Correct 301 codes (2015) Which GUI HTML editors work with WC ? (1997) WCf2 and nested tags (1997) Umm...about those log files? (Off Topic) (1997) [writefile] (1997) Exists? (1997) WebCatalog + Linux + ODBC + Oracle ! ? (2000)