Author Topic: Wildcards in Text Checks  (Read 413 times)

For the most part, I have not coded in years. Moreover, I was self-taught, and as such usually improvise where other code might be simpler. I am currently stuck on some code which I feel sure could be done better than how I'd have previously improvised. What I want is to check a line of text for containing another lines. But the line it is checking can have specific parts always different, so I need wildcards in this check. Here is an example using Regular Expression wildcards:

Code: [Select]
if(strStr(%line, "TheText(.*)doesn't like(.*)doodle.")
Is there anyway I could do something similar to the above? A command I forgot or wasn't aware? I think I would have improvised this by doing a bunch of strStr checks using &&, but that seems very stupid to me considering how straight forward the check is.

Edit: I think this was how I used to put things like this:

Code: [Select]
if(strStr(%line, "TheText") && strStr(%line, "doesn't like") && strStr(%line, "doodle."))
« Last Edit: March 24, 2012, 09:33:18 PM by MegaScientifical »

I think ? made a resource on this, lemme see if I can find it.

Edit:  It was M, silly one character names
http://forum.blockland.us/index.php?topic=177446.0

Those are very helpful actually. Although after setting up all the code and testing it, I'm getting a getSubStr error. I hate those, they are so generic, and considering how much that is used in this code... I have no idea where it's occurring. I guess I'll have to set up debug points.

Edit: My fault for being a dumbass and forgetting I need to enter text into the command. I copied the text, then kept re-executing by pressing up. I had to restart before, so I retyped it without the text.
« Last Edit: March 25, 2012, 12:56:42 AM by MegaScientifical »