Re: GREP Help

This WebDNA talk-list message is from

2001


It keeps the original formatting.
numero = 36601
interpreted = N
texte = Richard Kirsner wrote: > > We're having some fun with GREP in WebCat 4.X. Actually, when it works, > it's really useful and a big timesaver. But we're having some problems with > the following GREP statement. The idea is to take each line that ends > with a > : and change the style on that line only. > > [unurl][Grep search=(^[A-Z].*[%][3][A])&replace= class=smTxtBldSansBlu>\1][url][convertchars][FEAPICTTEXT1][/convert > chars][/url][/Grep][/unurl] > > This is the sample text from the a field in the database that we're > trying to modify: > > This is a New Feature: > This text describes the features. > Isn't it a fine set of features. > > This is Second Feature: > This text describes the features. > Isn't it a fine set of features. > > The grep statement is matching all text through the second :, and changing > the style, which we don't want. In this application, the user enters a lot > of text into one field of the database and we want to parse out the > delimited elements. > > What we need is it to match the first line in each para that ends with a > :. > > Any suggestions? > > BTW: anyone found a good GREP reference online? Especially syntax for the > REPLACE actions? > > Richard KirsnerFirst things first, http://www.oreilly.com/catalog/regex/ is the best general book on regular expressions that I am aware of.Secondly, grep is [typically] a line oriented function, not a block (paragraph) oriented function. That is not to say you cannot use it on multiline blocks, just that it is much harder to get everything correct.The asterisk (*) character is [typically] a greedy match. Try with plus (+) and see if that does what you want. I don't know exactly where PCS/SMSI got their grep library; it certainly doesn't see to be comparable to recent GNU grep's and it doesn't include any of the extended Perl grep functionality.HTHJohn -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4720 Boston Way Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5747------------------------------------------------------------- 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://search.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Grep help - catch all URLs (Tom Duke 2010)
  2. Re: [WebDNA] Grep help - catch all URLs (Stuart Tremain 2010)
  3. [WebDNA] Re: Grep help - catch all URLs (Tom Duke 2010)
  4. [WebDNA] Grep help - catch all URLs (Tom Duke 2010)
  5. Re: OT Grep Help ( Donovan Brooke 2008)
  6. Re: OT Grep Help ( Marc Thompson 2008)
  7. Re: OT Grep Help ( Donovan Brooke 2008)
  8. Re: OT Grep Help ( Marc Thompson 2008)
  9. OT Grep Help ( Donovan Brooke 2008)
  10. Re: Grep Help ( Alex McCombie 2007)
  11. Re: Grep Help ( Gary Krockover 2007)
  12. Re: Grep Help ( thierry 2007)
  13. Re: Grep Help ( "Gary Krockover" 2007)
  14. Re: Grep Help ( Donovan Brooke 2007)
  15. Re: Grep Help ( Gary Krockover 2007)
  16. Re: Grep Help ( Donovan Brooke 2007)
  17. Re: Grep Help ( Alex McCombie 2007)
  18. Re: Grep Help ( "Olin Lagon" 2007)
  19. Grep Help ( Alex McCombie 2007)
  20. Re: Grep help ( Lester 2005)
  21. Re: Grep help ( Lester 2005)
  22. Re: Grep help ( devaulw@onebox.com 2005)
  23. Grep help ( Lester 2005)
  24. Re: [OT] grep help ( John Peacock 2004)
  25. Re: [OT] grep help ( devaulw@onebox.com 2004)
  26. [OT] grep help ( Mark Derrick 2004)
  27. Re: Grep help needed ( Gary Krockover 2004)
  28. Re: Grep help needed ( Bob Minor 2004)
  29. Re: Grep help needed ( William DeVaul 2004)
  30. Grep help needed ( Gary Krockover 2004)
  31. Re: Grep help ( devaulw@onebox.com 2004)
  32. Re: Grep help ( Patrick McCormick 2004)
  33. Re: Grep help ( John Peacock 2004)
  34. Re: Grep help ( Patrick McCormick 2004)
  35. Re: Grep help ( devaulw@onebox.com 2004)
  36. Re: Grep help ( Patrick McCormick 2004)
  37. Grep help ( Patrick McCormick 2004)
  38. Re: Grep help ( Clint Davis 2004)
  39. Re: Grep help ( "Rajeev Kumar" 2004)
  40. Re: Grep help ( John Peacock 2004)
  41. Grep help ( "Rajeev Kumar" 2004)
  42. Re: WebDNA Grep help wanted ( Kenneth Grome 2004)
  43. Re: WebDNA Grep help wanted ( Gary Krockover 2004)
  44. Re: WebDNA Grep help wanted ( Kenneth Grome 2004)
  45. Re: WebDNA Grep help wanted ( William DeVaul 2004)
  46. Re: WebDNA Grep help wanted ( Kenneth Grome 2004)
  47. Re: WebDNA Grep help wanted ( Gary Krockover 2004)
  48. Re: WebDNA Grep help wanted ( devaulw@onebox.com 2004)
  49. Re: WebDNA Grep help wanted ( devaulw@onebox.com 2004)
  50. Re: WebDNA Grep help wanted ( "Andrew Simpson" 2004)
  51. Re: WebDNA Grep help wanted ( Palle Bo Nielsen 2004)
  52. Re: WebDNA Grep help wanted ( "Andrew Simpson" 2004)
  53. WebDNA Grep help wanted ( Palle Bo Nielsen 2004)
  54. Grep Help ( Donovan Brooke 2003)
  55. Re: Grep Help ( Matthew Bohne 2003)
  56. Grep Help ( Matthew Bohne 2003)
  57. Re: Grep Help ( Stuart Tremain 2003)
  58. Grep Help ( Jesse Williams-Proudman 2003)
  59. Re: Grep Help ( William DeVaul 2003)
  60. Grep Help ( Jesse Williams-Proudman 2003)
  61. Re: Grep Help ( Jesse Williams-Proudman 2003)
  62. Re: Grep Help ( Jesse Williams-Proudman 2003)
  63. Re: Grep Help ( Alain Russell 2003)
  64. Grep Help ( Jesse Williams-Proudman 2003)
  65. Re: Grep help, please ... (Nitai @ ComputerOil 2003)
  66. Re: Grep help, please ... (Kenneth Grome 2003)
  67. Re: Grep help, please ... (Nitai @ ComputerOil 2003)
  68. Re: Grep help, please ... (Dennis J. Bonsall, Jr. 2003)
  69. Grep help, please ... (Kenneth Grome 2003)
  70. Re: Grep help requested (Jim Lanford 2002)
  71. Grep help requested (William DeVaul, Connected Collector, Inc. 2002)
  72. Re: GREP Help (John Peacock 2001)
  73. GREP Help (Richard Kirsner 2001)
Richard Kirsner wrote: > > We're having some fun with GREP in WebCat 4.X. Actually, when it works, > it's really useful and a big timesaver. But we're having some problems with > the following GREP statement. The idea is to take each line that ends > with a > : and change the style on that line only. > > [unurl][Grep search=(^[A-Z].*[%][3][A])&replace= class=smTxtBldSansBlu>\1][url][convertchars][FEAPICTTEXT1][/convert > chars][/url][/Grep][/unurl] > > This is the sample text from the a field in the database that we're > trying to modify: > > This is a New Feature: > This text describes the features. > Isn't it a fine set of features. > > This is Second Feature: > This text describes the features. > Isn't it a fine set of features. > > The grep statement is matching all text through the second :, and changing > the style, which we don't want. In this application, the user enters a lot > of text into one field of the database and we want to parse out the > delimited elements. > > What we need is it to match the first line in each para that ends with a > :. > > Any suggestions? > > BTW: anyone found a good GREP reference online? Especially syntax for the > REPLACE actions? > > Richard KirsnerFirst things first, http://www.oreilly.com/catalog/regex/ is the best general book on regular expressions that I am aware of.Secondly, grep is [typically] a line oriented function, not a block (paragraph) oriented function. That is not to say you cannot use it on multiline blocks, just that it is much harder to get everything correct.The asterisk (*) character is [typically] a greedy match. Try with plus (+) and see if that does what you want. I don't know exactly where PCS/SMSI got their grep library; it certainly doesn't see to be comparable to recent GNU grep's and it doesn't include any of the extended Perl grep functionality.HTHJohn -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4720 Boston Way Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5747------------------------------------------------------------- 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://search.smithmicro.com/ John Peacock

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:

Ok here is a question? (1997) using showpage and showcart commands (1996) Help name our technology! I found it (1997) [WebDNA] SEARCH question - SHOWIF - HIDEIF question (2011) BBEdit and WebCatalog 2.0? (1997) Error: this shopping cart has already been submitted and (2006) WebTrends (2002) possible, WebCat2.0 and checkboxes-restated (1997) Location of Browser Info.txt file (1997) Frames and WebCat (1997) carriage returns in data (1997) expired beta (1997) Programmer Needed (1998) turning every 5th line red (1999) Help name our technology! (1997) Displaying raw values (1998) Webcatalog error, Plug-in for Webstar (1996) emailer settings and control questions (1997) [WebDNA] Serial numbers and pricing for WebDNA 7.0 (2011) [OT] HTML Email in Lotus Notes (2005)