Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] Count Occurrences Command

Expand Messages
  • Alec Burgess
    Art Kocsis (artkns@sbcglobal.net) wrote (in part) (on 2009-09-08 at ... Hi Art: ... Not tested but there s/b some way to turn the captured string into an
    Message 1 of 2 , Sep 8, 2009
    • 0 Attachment
      Art Kocsis (artkns@...) wrote (in part) (on 2009-09-08 at
      17:20):
      > Is there any command or RegEx that will count the occurrence of a
      > ^!Find
      > similar to the 'Count Occurrences" checkbox of the Find & Replace
      > toolbar
      > command? Obviously I could write a clip to accomplish this but I am
      > looking
      > for a single line statement. All of the option of the toolbar command
      > are
      > replicated in the clip command except this one.

      Hi Art:
      Check out:
      > ^$GetDocListAll("SearchPattern";"ReplaceString")$ (added in v5.7)
      >
      > Finds all matching strings in the current document (or selected text)
      > based on the SearchPattern regexp pattern. The function returns a
      > string with each match formatted according to the ReplaceString. See
      > the Substring Replacements page in the separate Regex.chm help file
      > for ReplaceString details.
      >
      > Example that collects and displays all URLs in a Web page:
      >
      > ^!Info [L]^$GetDocListAll("(?s)<a.+?href\s*?=\s*?"(.*?)"";"$1\r\n")$
      Not tested but there s/b some way to turn the captured string into an
      array and check the zero element - or more simply just replace all
      occurrences by (say) "#" and then do ^$StrSize("Str")$ on the result.

      --
      Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)




      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.