Finding text in SQL comments

Results 1 to 2 of 2

Thread: Finding text in SQL comments

  1. #1
    Join Date
    Dec 1969

    Default Finding text in SQL comments

    I want to search trough a string and find everything between /* and */ .. Im having trouble with * in between them... How would a pattern look like to just find /* .. and then search until */<BR><BR>/Magnus

  2. #2
    Join Date
    Dec 1969

    Default RE: Finding text in SQL comments

    ok, i tangled with this one for a while before i figured out i should use the ascii representation of the * and /, also *not* to use parenthesis around the inner search, check it out:<BR><BR>sOutput = "hello /* comment */ here i a/*hello/ world*/ i am here/*hello mom*/m."<BR>set objReg = new regexp<BR>objReg.Pattern = "/*[^x2Ax2F]**/"<BR>objReg.IgnoreCase = true<BR>objReg.Global = true<BR>set matches = objReg.Execute(sOutput)<BR>for each match in matches<BR> response.write match & "&amp;lt;BR&amp;gt;"<BR>next<BR>set matches = nothing<BR>set objReg = nothing<BR><BR><BR>this allows for "*" and "/" within the comment, it will not yield correct results when the astrick and slash are next to each other (as an ending comment), but why would you do that anyway ;-)<BR>i don&#039;t know regexp well enough to understand why the ascii hex representation is needed, but maybe one day. try it with this pattern and it just won&#039;t work:<BR><BR>"/*[^*/]**/"<BR><BR>go figure<BR><BR>justin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts