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

Re: [Clip] storing regex results in variables?

Expand Messages
  • Alan C.
    Hi Stephen, SampleCode, A native clip library comes with NoteTab either open it as document or better yet select a clip then right click the same clip and
    Message 1 of 3 , May 24, 2002
      Hi Stephen,

      SampleCode, A native clip library comes with NoteTab either open it as document or better yet select a clip then right click the same clip and choose edit clip brings the clip up in the editor. careful do not change and save or modification occurs. but, just to look

      >above, I was hoping to put the filenames in variables

      I speak generally about set (set can used for much more than just filenames) if U look in help and elsewhere to find specifically about set and filenames.
      SampleCode, under heading "delimited text" a clip entitled "search fields" it contains numerous lines of code whereby many (specific set type of line I refer to) begins with the
      ^!Set command which is how you put into variable.

      >and test on them,
      >e.g. "If newly found animation filename equals ^%currentFilename%,
      >then..."

      SampleCode, A clip near bottom entitled "Set Bookmark" that clip's first line of code uses the ^!ifsame command which is one method to detect whether or not is a match. And, Other comparison methods exist also, such as ^!If

      Regard. Alan.
    • Alan C.
      Hi Stephen, ========== Instead of the regex replace you would have to use the find (^!Find) (perhaps with regex) which, once the item is found, the ^!Find
      Message 2 of 3 , May 25, 2002
        Hi Stephen,

        ==========> Instead of the regex replace you would have to use the find (^!Find) (perhaps with regex) which, once the item is found, the ^!Find leaves the item selected
        once its selected then use the getselection function to put it into a variable thus

        ^!Find line here
        ^!Delay 3 (might be needed)
        ^!Set %my_cur_fil_nam%=^$GetSelection

        If U are to find possibly more than 1 then U would need to either 1. work with it first then come back to same spot in your text to continue on with the find and go again or 2. append each found item to an array (Ntab can do either)

        >some HTML to a loose XML, and I was wishing I could take those \1 and \2
        >results from regex and store them in variables to do tests on. Is this
        >possible?

        see above. And also,

        New in NoteTab ver. 4.8 or later is command

        ^!Match

        I've not yet used it myself. But it to check a regex to see if the regex matches something else specified.

        ^!IfDiff

        ^!IfTrue

        and there's more. There are lots of ways to do what you want.

        Here's a clip that will launch the .hlp help file for clip help

        H="ClipHelp_hlp"
        ^!Shell "^$GetAppPath$ClipCode.hlp"
        ; ----<end clip<<

        Get ClipCode.hlp launched then click its index tab. Then scroll up - down and look at all the various commands. take note that further down are the functions (each begins with ^$)

        You'll see items that I mentioned plus much more it's like an itemized list. Just select an item then click display brings up the help window for that item.

        newly found animation filename (my abbreviation is: nfaf)

        ^!IfSame "^%my_cur_fil_nam%" "nfaf" it_matches
        if not same routes to this code here
        carries onward to this code here
        carries onward to this code here
        ^!Goto after_match
        :it_matches
        ; :it_matches is a label whereby if a match then it jumps over (jumps from IfSame line) goes directly to :it_matches
        ; code
        ; more code
        :after_match
        ; if did NOT have a match, it does use code in the section ABOVE the it_matches label until it gets down to the ^!Goto line. Such Goto makes it skip the it_matches section of code and instead it jumps from the Goto line down to the :after_match which is another label, a labeled section of your clip.

        HTH Regards. Alan.
      Your message has been successfully submitted and would be delivered to recipients shortly.