1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Feedback Advanced search and replace functions

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Daniel Mallett, Nov 1, 2019.

  1. Daniel Mallett

    Daniel Mallett Member

    Joined:
    Aug 24, 2017
    Posts:
    165
    This a fairly generic non-programming specific question. I hope this is in the correct category. I apologize if not.

    The search and replace function within GMS is fairly straight forward. The only extra option you have is to search case sensitive, that's about it.

    Does anyone have any recommendations for some more advanced search tools?

    Here are a couple of examples of things I would like to do. (Never mind why too much, the point is the tools are not sufficient)

    1) find // and delete everything after and including that that appears on the same line (remove comments)

    2) Find where there is and if statement, ignore everything after that until a new if statement is found without a statement in between. (replace if then if with if && if)

    3) Find where if = but not does follow another = (Find where I have missed an extra = symbol out)

    Gamemaker can't do this. I'm pretty sure. Could someone recommend something a bit more comprehensive than theGMS text editor environment.
     
  2. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,426
    GMEdit has regular expression search-replace, so you can use
    Code:
    //.*\r\n
    
    for that.

    Same, but a little trickier (take a look at regexp tutorials and use "preview replace"). Also, watch out - "if A if B then C else D" is not the same as "if A and B then C else D".

    GMEdit beta has a linter option very specifically to warn about single-equals comparisons.
     
    Cloaked Games likes this.
  3. Daniel Mallett

    Daniel Mallett Member

    Joined:
    Aug 24, 2017
    Posts:
    165
    That's a great answer thank you.
     
  4. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,607

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice