+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: I would like to search for the character 1 but not for 11. Even better not for 1.n.

  1. #1
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    322

    I would like to search for the character 1 but not for 11. Even better not for 1.n.

    Hello,

    I would like to search for the character 1 but not for 11. Even better not for 1.n,
    where n is any of the integers, 1,2,3,4,5,6,0.


    Thanks,

    -peter

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Location
    British Columbia, Canada
    Posts
    383
    Hi Peter,

    I think the attached find1.vdm will do what you want.

    Scott
    Attached Files Attached Files
    Using Vedit 6.21.3, (32 bit), dated 9/12/11 running on Windows 7 (64 bit).

  3. #3
    Thanks Scott,

    I have tried and I have some problems with your find1.vdm maro.

    Here are the details:
    It did find and highlight the numbers 3.13. However, it did not find the number 3.1.

    -peter

  4. #4
    Senior Member
    Join Date
    Aug 2011
    Location
    British Columbia, Canada
    Posts
    383
    Hi Peter,

    I am unable to replicate your problem. I have a buffer with the following:

    2

    11

    1

    1.6

    1.9

    3.1

    4.15

    5.31

    When I execute the macro, it stops on all the 1 except the 11 and the 1.6.

    Scott
    Using Vedit 6.21.3, (32 bit), dated 9/12/11 running on Windows 7 (64 bit).

  5. #5
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    322
    Quote Originally Posted by Scott Lambert View Post
    Hi Peter,

    I am unable to replicate your problem. I have a buffer with the following:

    2

    11

    1

    1.6

    1.9

    3.1

    4.15

    5.31

    When I execute the macro, it stops on all the 1 except the 11 and the 1.6.

    Scott


    Thanks Scott,

    I could replicate your experiment.

    However, if i Use it on my .texfile it also stops at.

    \eqref{eq:A.18}


    Do you have a reaction ?

    -peter

  6. #6
    Senior Member
    Join Date
    Aug 2011
    Location
    British Columbia, Canada
    Posts
    383
    Hi Peter,

    If you refer to your original message in this thread, there is no reason why it should not stop at \eqref{eq:A.18}.

    According to what you gave me, the macro should stop on all 1 except if it is an 11 or a 1 followed by .1, .2, .3, .4, .5, .6, or .0

    So, the macro is doing what you said it should by stopping at \eqref{eq:A.18}.

    Scott
    Using Vedit 6.21.3, (32 bit), dated 9/12/11 running on Windows 7 (64 bit).

  7. #7
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    322
    Thanks Scott,

    So, I shall extend your macro to include the numbers 7,8,9, in addition to the numbers
    1,2,3,4,5, 6.


    Thanks again,

    -peter

  8. #8
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    322
    Scott,

    I am back to your macro, find1.vdm.

    Now, I would like to search for the string alpha , but not the string \alpha.

    In other words, I would like to replace the character 1 by the string alpha and the
    set of "negation elements" by the set consisting of the string \alpha.

    I have tried and could not do it. I have a hunch that I am missing something simple.
    This is that I did,


    // find()_but().vdm

    repeat(all) {
    search("alpha",noerr)
    if(return_value==0) {
    end_of_file()
    break
    }
    char(-1)
    match("|{\}")
    if(match_item>0) {
    continue
    } else {
    char(-1)
    break
    }
    }

    Thanks as always,

    -peter

  9. #9
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    322
    Scott,

    I did a little bit more thinking about my problem.

    I think that this problem might be easier than your find1.vdm, inasmuch as the
    "negation set" consists of a single character. So, I was playing around with the Vedit Cur_Char( ) command. I came up with somethings that hangs. I have a hunch that I might be close to a solution. Here it is anyway:

    // find()_but().vdm
    // Rejto adaptation of Scott's find1.vdm; 2015-06-28.


    repeat(all) {
    search("alpha",noerr)
    if(return_value==0) {
    end_of_file()
    break
    }
    char(-1)
    #11=Cur_Char()
    if(#11==92) {
    continue
    } else {
    char(5)
    break
    }
    }


    // Note the flow control command Syntax from the Vedit On_Line_help.

    if (c) {
    commands-1
    }
    else {
    commands-2
    }

  10. #10
    Senior Member
    Join Date
    Aug 2011
    Location
    British Columbia, Canada
    Posts
    383
    Hi Peter,

    I tried to make your second version of the macro work, but no luck. Debugging other people's code is not my talent. I seem to have to write the original code to make it work.

    Which I have done so, and have attached findalpha.vdm which should do what you want.

    Scott
    Attached Files Attached Files
    Using Vedit 6.21.3, (32 bit), dated 9/12/11 running on Windows 7 (64 bit).

+ Reply to Thread

Tags for this Thread

Posting Permissions

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