Opry99er Posted May 3, 2015 Share Posted May 3, 2015 (edited) I am currently going through a huge conversion in a game project replacing virtually all the "alike" variables into indexed arrays. Problem is, when I do a 'search and replace', it isn't looking for exclusive variable names, rather--any portion of any string that has the letter combination gets "found" and I have to toggle through 20-30 non-variable string portions in order to find the 4-5 actual variable references for changing. For instance... If I want to replace MHP with HP(3,2), I have to cycle through all references to MMHP,BMHP,SMHP, etc while looking for the sovereign "MHP" variable. Is there an option in Find and Replace that will narrow down the search to ONLY find or replace the variable MHP with HP(3,2)? Would using quotation marks around the search object do it, or is there a box I can click or something? I have about 40 variables to replace with arrays, so just doing ONE set of (4,2) took about 15 minutes last night. I am away from my computer right now, but I will be returning to the conversion tonight. Any help would be appreciated. Edited May 3, 2015 by Opry99er Quote Link to comment https://forums.atariage.com/topic/237897-ot-notepad-tips/ Share on other sites More sharing options...
RobertLM78 Posted May 3, 2015 Share Posted May 3, 2015 Use spaces when you search, for example, search for ' MHP ' or ' MHP=', etc. instead of 'MHP'. That way it'll exclude things like 'MMHP' 1 Quote Link to comment https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3230624 Share on other sites More sharing options...
Opry99er Posted May 3, 2015 Author Share Posted May 3, 2015 Yea.... Smart. The leading space should do the trick. I wasnt thinking about it that way. Thanks! Quote Link to comment https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3230643 Share on other sites More sharing options...
+Lee Stewart Posted May 3, 2015 Share Posted May 3, 2015 Check “Match whole word only”. ...lee 1 Quote Link to comment https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3230646 Share on other sites More sharing options...
Opry99er Posted May 3, 2015 Author Share Posted May 3, 2015 Funny... I looked for something like that but didn't see it. I will look again with non-3AM eyes. Thanks! Quote Link to comment https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3230649 Share on other sites More sharing options...
matthew180 Posted May 4, 2015 Share Posted May 4, 2015 The problem with text editors is that they only know text. This is where an IDE with intellisense really shines because the editor is parsing the code and understands the difference between what is a variable vs. a string, vs. a comment, etc. Such editors let you do something call "refactor" a variable, i.e. change its name (or its type) easily and correctly. Syntax highlighting is a crude form of intellisense but it does not have the power to do things like refactoring of variables or functions. Sadly I do not know of any intellisense editors for BASIC (any BASIC), let alone our specific dialect. In these cases I use the "replace - next" feature that most editors have. Replace-next will replace the current match, then find the next match, all with a single click. This lets you put your eyes on each match quickly and decide if you want to replace it or skip it. Quote Link to comment https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3230934 Share on other sites More sharing options...
Willsy Posted May 4, 2015 Share Posted May 4, 2015 Visual Basic.net has full intellisense (in visual studio) including the ability to refactor etc. 1 Quote Link to comment https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3231010 Share on other sites More sharing options...
RobertLM78 Posted May 4, 2015 Share Posted May 4, 2015 ...Sadly I do not know of any intellisense editors for BASIC (any BASIC), let alone our specific dialect. In these cases I use the "replace - next" feature that most editors have. Replace-next will replace the current match, then find the next match, all with a single click. This lets you put your eyes on each match quickly and decide if you want to replace it or skip it. FreeBASIC + Geany appears to have some capabilities; I'm pretty sure I saw Geany recognizing variables, but I'm not positive, I've only been playing with FreeBASIC for a couple days now. I also just got FreeBASIC syntax highlighting to work in Pluma, but now that you mention it I should write a .lang file for our dialect . Quote Link to comment https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3231013 Share on other sites More sharing options...
unhuman Posted May 4, 2015 Share Posted May 4, 2015 Use regular expressions for search and replace. It can be a bit tricky to learn, since pattern matching is far more complicated / capable than using * and ?, but you can do replacements in an automated fashion. On Windows, get this tool: http://rad-software-regular-expression-designer.software.informer.com/1.4/ Quote Link to comment https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3231096 Share on other sites More sharing options...
Opry99er Posted May 4, 2015 Author Share Posted May 4, 2015 I was able to complete the conversion last night. I thought the leading space would do the trick, but it did not, as there were lines in there like AHP=MHP That was missed in the search. I did find the "whole word only" box, which I cannot believe I.missed the other night. That did the trick. Once my multi-dimensional arrays were completed, the one dimensional arrays went fast. Took about 50 minutes last night to completely transition the variables. Took another 20 or so minutes to debug the INPUT routines from disk. All is well. Thanks guys... For your help. 3 Quote Link to comment https://forums.atariage.com/topic/237897-ot-notepad-tips/#findComment-3231238 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.